/*
               File: Publicidad
        Description: Publicidad
             Author: GeneXus C# Generator version 10_2_1-58381
       Generated on: 8/28/2012 21:7:14.41
       Program type: Callable routine
          Main DBMS: sqlserver
*/
using System;
using System.Collections;
using GeneXus.Utils;
using GeneXus.Resources;
using GeneXus.Application;
using GeneXus.Metadata;
using System.Data;
using System.Data.SqlClient;
using GeneXus.Data;
using com.genexus;
using GeneXus.Data.ADO;
using GeneXus.Data.NTier;
using GeneXus.Data.NTier.ADO;
using System.Runtime.Remoting;
using GeneXus.WebControls;
using GeneXus.Http;
using GeneXus.XML;
using GeneXus.Search;
using GeneXus.Encryption;
using GeneXus.Http.Client;
using System.Xml.Serialization;
using System.Data.SqlTypes;
using System.ServiceModel;
using System.Runtime.Serialization;
namespace GeneXus.Programs {
   public class publicidad : GXDataArea, System.Web.SessionState.IRequiresSessionState
   {
      protected void INITENV( )
      {
         if ( GxWebError != 0 )
         {
            return  ;
         }
      }

      protected void INITTRN( )
      {
         initialize_properties( ) ;
         entryPointCalled = false ;
         gxfirstwebparm = GetNextPar( ) ;
         gxfirstwebparm_bkp = gxfirstwebparm ;
         gxfirstwebparm = DecryptAjaxCall( gxfirstwebparm) ;
         if ( StringUtil.StrCmp(gxfirstwebparm, "dyncall") == 0 )
         {
            setAjaxCallMode();
            if ( ! IsValidAjaxCall( true) )
            {
               GxWebError = 1 ;
               return  ;
            }
            dyncall( GetNextPar( )) ;
            return  ;
         }
         else if ( StringUtil.StrCmp(gxfirstwebparm, "gxajaxEvt") == 0 )
         {
            setAjaxEventMode();
            if ( ! IsValidAjaxCall( true) )
            {
               GxWebError = 1 ;
               return  ;
            }
            gxfirstwebparm = GetNextPar( ) ;
         }
         else if ( StringUtil.StrCmp(gxfirstwebparm, "gxajaxNewRow_"+"Gridpublicidad_pcosto") == 0 )
         {
            nRC_Gridpublicidad_pcosto = (short)(NumberUtil.Val( GetNextPar( ), ".")) ;
            nGXsfl_56_idx = (short)(NumberUtil.Val( GetNextPar( ), ".")) ;
            sGXsfl_56_idx = GetNextPar( ) ;
            setAjaxCallMode();
            if ( ! IsValidAjaxCall( true) )
            {
               GxWebError = 1 ;
               return  ;
            }
            gxnrGridpublicidad_pcosto_newrow( nRC_Gridpublicidad_pcosto, nGXsfl_56_idx, sGXsfl_56_idx) ;
            return  ;
         }
         else
         {
            if ( ! IsValidAjaxCall( false) )
            {
               GxWebError = 1 ;
               return  ;
            }
            gxfirstwebparm = gxfirstwebparm_bkp ;
         }
         if ( ! entryPointCalled )
         {
            Gx_mode = gxfirstwebparm ;
            context.httpAjaxContext.ajax_rsp_assign_attri("", false, "Gx_mode", Gx_mode);
            if ( StringUtil.StrCmp(gxfirstwebparm, "viewer") != 0 )
            {
               AV12PublicidadId = (short)(NumberUtil.Val( GetNextPar( ), ".")) ;
               context.httpAjaxContext.ajax_rsp_assign_attri("", false, "AV12PublicidadId", StringUtil.LTrim( StringUtil.Str( (decimal)(AV12PublicidadId), 4, 0)));
            }
         }
         Form.Meta.addItem("Generator", "GeneXus C# 10_2_1-58381", 0) ;
         Form.Meta.addItem("Description", "Publicidad", 0) ;
         context.wjLoc = "" ;
         context.nUserReturn = 0 ;
         context.wbHandled = 0 ;
         if ( StringUtil.StrCmp(context.GetRequestMethod( ), "POST") == 0 )
         {
         }
         GX_FocusControl = edtPublicidadImg_Internalname ;
         context.httpAjaxContext.ajax_rsp_assign_attri("", false, "GX_FocusControl", GX_FocusControl);
         wbErr = false ;
         context.SetDefaultTheme("GeneXusXEv2");
      }

      public publicidad( )
      {
         context = new GxContext(  );
         DataStoreUtil.LoadDataStores( context);
         dsDefault = context.GetDataStore("Default") ;
         IsMain = true;
         context.SetDefaultTheme("GeneXusXEv2");
      }

      public publicidad( IGxContext context )
      {
         this.context = context;
         IsMain = false;
         dsDefault = context.GetDataStore("Default") ;
      }

      public void release( )
      {
      }

      public void execute( String aP0_Gx_mode ,
                           short aP1_PublicidadId )
      {
         this.Gx_mode = aP0_Gx_mode;
         this.AV12PublicidadId = aP1_PublicidadId;
         executePrivate();
      }

      void executePrivate( )
      {
         isStatic = false;
         webExecute();
      }

      protected override void createObjects( )
      {
      }

      public override void webExecute( )
      {
         if ( initialized == 0 )
         {
            createObjects();
            initialize();
         }
         INITENV( ) ;
         INITTRN( ) ;
         if ( ( GxWebError == 0 ) && ! isAjaxCallMode( ) )
         {
            MasterPageObj = (GXMasterPage) ClassLoader.GetInstance("appmasterpage", "GeneXus.Programs.appmasterpage", new Object[] {new GxContext( context.handle, context.DataStores, context.HttpContext)});
            MasterPageObj.setDataArea(this,false);
            MasterPageObj.webExecute();
            if ( context.isAjaxRequest( ) )
            {
               enableOutput();
               if ( ! context.isAjaxRequest( ) )
               {
                  context.GX_webresponse.AppendHeader("Cache-Control", "max-age=0");
               }
               if ( String.IsNullOrEmpty(StringUtil.RTrim( context.wjLoc)) )
               {
                  context.GX_webresponse.AddString((String)(context.getJSONResponse( )));
               }
               else
               {
                  if ( context.isAjaxRequest( ) )
                  {
                     disableOutput();
                  }
                  RenderHtmlHeaders( ) ;
                  context.Redirect( context.wjLoc );
                  context.DispatchAjaxCommands();
               }
            }
         }
         this.cleanup();
      }

      protected void Draw( )
      {
         if ( context.isAjaxRequest( ) )
         {
            disableOutput();
         }
         if ( ! GxWebStd.gx_redirect( context) )
         {
            disable_std_buttons( ) ;
            enableDisable( ) ;
            set_caption( ) ;
            /* Form start */
            wb_table1_2_066( true) ;
         }
         return  ;
      }

      protected void wb_table1_2_066e( bool wbgen )
      {
         if ( wbgen )
         {
         }
         /* Execute Exit event if defined. */
      }

      protected void wb_table1_2_066( bool wbgen )
      {
         if ( wbgen )
         {
            /* Table start */
            sStyleString = "" ;
            GxWebStd.gx_table_start( context, tblTablemain_Internalname, tblTablemain_Internalname, "", "TableBorder100x100", 0, "", "", 1, 2, sStyleString, "", 0);
            context.WriteHtmlText( "<tbody>") ;
            context.WriteHtmlText( "<tr>") ;
            context.WriteHtmlText( "<td>") ;
            wb_table2_5_066( true) ;
         }
         return  ;
      }

      protected void wb_table2_5_066e( bool wbgen )
      {
         if ( wbgen )
         {
            /* Control Group */
            ClassString = "Group" ;
            StyleString = "" ;
            context.WriteHtmlText( "<fieldset id=\""+grpGroupdata_Internalname+"\""+" style=\"-moz-border-radius:3pt;\""+" class=\""+ClassString+"\">") ;
            context.WriteHtmlText( "<legend class=\""+ClassString+"Title"+"\">"+"Publicidad"+"</legend>") ;
            wb_table3_28_066( true) ;
         }
         return  ;
      }

      protected void wb_table3_28_066e( bool wbgen )
      {
         if ( wbgen )
         {
            context.WriteHtmlText( "</fieldset>") ;
            context.WriteHtmlText( "</td>") ;
            context.WriteHtmlText( "</tr>") ;
            context.WriteHtmlText( "</tbody>") ;
            /* End of table */
            context.WriteHtmlText( "</table>") ;
            wb_table1_2_066e( true) ;
         }
         else
         {
            wb_table1_2_066e( false) ;
         }
      }

      protected void wb_table3_28_066( bool wbgen )
      {
         if ( wbgen )
         {
            /* Table start */
            sStyleString = "" ;
            GxWebStd.gx_table_start( context, tblTable1_Internalname, tblTable1_Internalname, "", "Table", 0, "", "", 1, 2, sStyleString, "", 0);
            context.WriteHtmlText( "<tbody>") ;
            context.WriteHtmlText( "<tr>") ;
            context.WriteHtmlText( "<td>") ;
            ClassString = "ErrorViewer" ;
            StyleString = "" ;
            GxWebStd.gx_msg_list( context, "", context.GX_msglist.DisplayMode, StyleString, ClassString, "", "false");
            context.WriteHtmlText( "</td>") ;
            context.WriteHtmlText( "</tr>") ;
            context.WriteHtmlText( "<tr>") ;
            context.WriteHtmlText( "<td>") ;
            wb_table4_34_066( true) ;
         }
         return  ;
      }

      protected void wb_table4_34_066e( bool wbgen )
      {
         if ( wbgen )
         {
            context.WriteHtmlText( "</td>") ;
            context.WriteHtmlText( "</tr>") ;
            context.WriteHtmlText( "<tr>") ;
            context.WriteHtmlText( "<td>") ;
            TempTags = "  onfocus=\"gx.evt.onfocus(this, 61,'',false,'',0)\"" ;
            ClassString = "BtnEnter" ;
            StyleString = "" ;
            GxWebStd.gx_button_ctrl( context, bttBtn_enter_Internalname, "", "Confirmar", bttBtn_enter_Jsonclick, 5, "Confirmar", "", StyleString, ClassString, bttBtn_enter_Visible, 1, "standard", "EENTER.", TempTags, "", context.GetButtonType( ), "HLP_Publicidad.htm");
            TempTags = "  onfocus=\"gx.evt.onfocus(this, 62,'',false,'',0)\"" ;
            ClassString = "BtnCancel" ;
            StyleString = "" ;
            GxWebStd.gx_button_ctrl( context, bttBtn_cancel_Internalname, "", "Cancelar", bttBtn_cancel_Jsonclick, 1, "Cancelar", "", StyleString, ClassString, bttBtn_cancel_Visible, 1, "standard", "ECANCEL.", TempTags, "", context.GetButtonType( ), "HLP_Publicidad.htm");
            TempTags = "  onfocus=\"gx.evt.onfocus(this, 63,'',false,'',0)\"" ;
            ClassString = "BtnDelete" ;
            StyleString = "" ;
            GxWebStd.gx_button_ctrl( context, bttBtn_delete_Internalname, "", "Eliminar", bttBtn_delete_Jsonclick, 5, "Eliminar", "", StyleString, ClassString, bttBtn_delete_Visible, 0, "standard", "EDELETE.", TempTags, "", context.GetButtonType( ), "HLP_Publicidad.htm");
            context.WriteHtmlText( "</td>") ;
            context.WriteHtmlText( "</tr>") ;
            context.WriteHtmlText( "</tbody>") ;
            /* End of table */
            context.WriteHtmlText( "</table>") ;
            wb_table3_28_066e( true) ;
         }
         else
         {
            wb_table3_28_066e( false) ;
         }
      }

      protected void wb_table4_34_066( bool wbgen )
      {
         if ( wbgen )
         {
            /* Table start */
            sStyleString = "" ;
            GxWebStd.gx_table_start( context, tblTable2_Internalname, tblTable2_Internalname, "", "Table", 0, "", "", 1, 2, sStyleString, "", 0);
            context.WriteHtmlText( "<tbody>") ;
            context.WriteHtmlText( "<tr>") ;
            context.WriteHtmlText( "<td class=\"td5\"  style=\"vertical-align:top\">") ;
            /* Text block */
            ClassString = "TextBlock" ;
            StyleString = "" ;
            GxWebStd.gx_label_ctrl( context, lblTextblockpublicidadid_Internalname, "Id", "", "", lblTextblockpublicidadid_Jsonclick, "", StyleString, ClassString, 0, "", 1, 1, 0, "HLP_Publicidad.htm");
            context.WriteHtmlText( "</td>") ;
            context.WriteHtmlText( "<td>") ;
            /* Single line edit */
            ClassString = "Attribute" ;
            StyleString = "" ;
            GxWebStd.gx_single_line_edit( context, edtPublicidadId_Internalname, StringUtil.LTrim( StringUtil.NToC( (decimal)(A16PublicidadId), 4, 0, ",", "")), ((edtPublicidadId_Enabled!=0) ? StringUtil.LTrim( context.localUtil.Format( (decimal)(A16PublicidadId), "ZZZ9")) : context.localUtil.Format( (decimal)(A16PublicidadId), "ZZZ9")), "", "", "", "", "", "", edtPublicidadId_Jsonclick, 0, ClassString, StyleString, "", 1, edtPublicidadId_Enabled, 0, "text", "", 4, "chr", 1, "row", 4, 0, 0, 0, 1, -1, true, "Id", "right", "HLP_Publicidad.htm");
            context.WriteHtmlText( "</td>") ;
            context.WriteHtmlText( "</tr>") ;
            context.WriteHtmlText( "<tr>") ;
            context.WriteHtmlText( "<td class=\"td5\"  style=\"vertical-align:top\">") ;
            /* Text block */
            ClassString = "TextBlock" ;
            StyleString = "" ;
            GxWebStd.gx_label_ctrl( context, lblTextblockpublicidadimg_Internalname, "Img", "", "", lblTextblockpublicidadimg_Jsonclick, "", StyleString, ClassString, 0, "", 1, 1, 0, "HLP_Publicidad.htm");
            context.WriteHtmlText( "</td>") ;
            context.WriteHtmlText( "<td>") ;
            ClassString = "Image" ;
            StyleString = "" ;
            TempTags = "  onfocus=\"gx.evt.onfocus(this, 44,'',false,'',0)\"" ;
            edtPublicidadImg_Filetype = "tmp" ;
            context.httpAjaxContext.ajax_rsp_assign_prop("", false, edtPublicidadImg_Internalname, "Filetype", edtPublicidadImg_Filetype);
            if ( ! String.IsNullOrEmpty(StringUtil.RTrim( A17PublicidadImg)) )
            {
               gxblobfileaux.Source = A17PublicidadImg ;
               if ( ! gxblobfileaux.HasExtension() || ( StringUtil.StrCmp(edtPublicidadImg_Filetype, "tmp") != 0 ) )
               {
                  gxblobfileaux.SetExtension(StringUtil.Trim( edtPublicidadImg_Filetype));
               }
               if ( gxblobfileaux.ErrCode == 0 )
               {
                  A17PublicidadImg = gxblobfileaux.GetAbsoluteName() ;
                  context.httpAjaxContext.ajax_rsp_assign_attri("", false, "A17PublicidadImg", A17PublicidadImg);
               }
            }
            GxWebStd.gx_blob_field( context, edtPublicidadImg_Internalname, StringUtil.RTrim( A17PublicidadImg), context.PathToRelativeUrl( A17PublicidadImg), (String.IsNullOrEmpty(StringUtil.RTrim( edtPublicidadImg_Contenttype)) ? context.GetContentType( (String.IsNullOrEmpty(StringUtil.RTrim( edtPublicidadImg_Filetype)) ? A17PublicidadImg : edtPublicidadImg_Filetype)) : edtPublicidadImg_Contenttype), false, "", edtPublicidadImg_Parameters, 0, edtPublicidadImg_Enabled, 1, "", "", 0, -1, 250, "px", 60, "px", 0, 0, 0, edtPublicidadImg_Jsonclick, "", StyleString, ClassString, ""+TempTags+" onchange=\"gx.evt.onchange(this)\" "+" onblur=\""+""+";gx.evt.onblur(44);\"", "", "", "HLP_Publicidad.htm");
            context.httpAjaxContext.ajax_rsp_assign_prop("", false, edtPublicidadImg_Internalname, "URL", context.PathToRelativeUrl( A17PublicidadImg));
            context.WriteHtmlText( "</td>") ;
            context.WriteHtmlText( "</tr>") ;
            context.WriteHtmlText( "<tr>") ;
            context.WriteHtmlText( "<td class=\"td5\"  style=\"vertical-align:top\">") ;
            /* Text block */
            ClassString = "TextBlock" ;
            StyleString = "" ;
            GxWebStd.gx_label_ctrl( context, lblTextblockpublicidaddetalle_Internalname, "Detalle", "", "", lblTextblockpublicidaddetalle_Jsonclick, "", StyleString, ClassString, 0, "", 1, 1, 0, "HLP_Publicidad.htm");
            context.WriteHtmlText( "</td>") ;
            context.WriteHtmlText( "<td>") ;
            /* Single line edit */
            TempTags = "  onfocus=\"gx.evt.onfocus(this, 49,'',false,'',0)\"" ;
            ClassString = "Attribute" ;
            StyleString = "" ;
            GxWebStd.gx_single_line_edit( context, edtPublicidadDetalle_Internalname, StringUtil.LTrim( StringUtil.NToC( (decimal)(A41PublicidadDetalle), 4, 0, ",", "")), ((edtPublicidadDetalle_Enabled!=0) ? StringUtil.LTrim( context.localUtil.Format( (decimal)(A41PublicidadDetalle), "ZZZ9")) : context.localUtil.Format( (decimal)(A41PublicidadDetalle), "ZZZ9")), TempTags+" onchange=\"gx.evt.onchange(this)\" "+" onblur=\""+"gx.num.valid_integer( this,'.');"+";gx.evt.onblur(49);\"", "", "", "", "", "", edtPublicidadDetalle_Jsonclick, 0, ClassString, StyleString, "", 1, edtPublicidadDetalle_Enabled, 0, "text", "", 4, "chr", 1, "row", 4, 0, 0, 0, 1, -1, true, "", "right", "HLP_Publicidad.htm");
            context.WriteHtmlText( "</td>") ;
            context.WriteHtmlText( "</tr>") ;
            context.WriteHtmlText( "<tr>") ;
            context.WriteHtmlText( "<td colspan=\"2\" >") ;
            context.WriteHtmlText( "<br/>") ;
            wb_table5_52_066( true) ;
         }
         return  ;
      }

      protected void wb_table5_52_066e( bool wbgen )
      {
         if ( wbgen )
         {
            context.WriteHtmlText( "<hr class=\"HRDefault\"/>") ;
            /*  Grid Control  */
            Gridpublicidad_pcostoContainer.AddObjectProperty("GridName", "Gridpublicidad_pcosto");
            Gridpublicidad_pcostoContainer.AddObjectProperty("Class", "Grid");
            Gridpublicidad_pcostoContainer.AddObjectProperty("Cellpadding", StringUtil.LTrim( StringUtil.NToC( (decimal)(1), 4, 0, ".", "")));
            Gridpublicidad_pcostoContainer.AddObjectProperty("Cellspacing", StringUtil.LTrim( StringUtil.NToC( (decimal)(2), 4, 0, ".", "")));
            Gridpublicidad_pcostoContainer.AddObjectProperty("Backcolorstyle", StringUtil.LTrim( StringUtil.NToC( (decimal)(subGridpublicidad_pcosto_Backcolorstyle), 1, 0, ".", "")));
            Gridpublicidad_pcostoContainer.AddObjectProperty("CmpContext", "");
            Gridpublicidad_pcostoContainer.AddObjectProperty("InMasterPage", "false");
            Gridpublicidad_pcostoColumn = GXWebColumn.GetNew(isAjaxCallMode( )) ;
            Gridpublicidad_pcostoColumn.AddObjectProperty("Value", context.localUtil.Format(A20PCostoFecha, "99/99/99"));
            Gridpublicidad_pcostoColumn.AddObjectProperty("Enabled", StringUtil.LTrim( StringUtil.NToC( (decimal)(edtPCostoFecha_Enabled), 5, 0, ".", "")));
            Gridpublicidad_pcostoContainer.AddColumnProperties(Gridpublicidad_pcostoColumn);
            Gridpublicidad_pcostoColumn = GXWebColumn.GetNew(isAjaxCallMode( )) ;
            Gridpublicidad_pcostoColumn.AddObjectProperty("Value", StringUtil.LTrim( StringUtil.NToC( (decimal)(A21PCostoMonto), 4, 0, ".", "")));
            Gridpublicidad_pcostoColumn.AddObjectProperty("Enabled", StringUtil.LTrim( StringUtil.NToC( (decimal)(edtPCostoMonto_Enabled), 5, 0, ".", "")));
            Gridpublicidad_pcostoContainer.AddColumnProperties(Gridpublicidad_pcostoColumn);
            Gridpublicidad_pcostoContainer.AddObjectProperty("Allowselection", StringUtil.LTrim( StringUtil.NToC( (decimal)(subGridpublicidad_pcosto_Allowselection), 1, 0, ".", "")));
            Gridpublicidad_pcostoContainer.AddObjectProperty("Selectioncolor", StringUtil.LTrim( StringUtil.NToC( (decimal)(subGridpublicidad_pcosto_Selectioncolor), 9, 0, ".", "")));
            Gridpublicidad_pcostoContainer.AddObjectProperty("Allowhover", StringUtil.LTrim( StringUtil.NToC( (decimal)(subGridpublicidad_pcosto_Allowhovering), 1, 0, ".", "")));
            Gridpublicidad_pcostoContainer.AddObjectProperty("Hovercolor", StringUtil.LTrim( StringUtil.NToC( (decimal)(subGridpublicidad_pcosto_Hoveringcolor), 9, 0, ".", "")));
            Gridpublicidad_pcostoContainer.AddObjectProperty("Allowcollapsing", StringUtil.LTrim( StringUtil.NToC( (decimal)(subGridpublicidad_pcosto_Allowcollapsing), 1, 0, ".", "")));
            Gridpublicidad_pcostoContainer.AddObjectProperty("Collapsed", StringUtil.LTrim( StringUtil.NToC( (decimal)(subGridpublicidad_pcosto_Collapsed), 1, 0, ".", "")));
            nGXsfl_56_idx = 0 ;
            if ( ( nKeyPressed == 1 ) && ( AnyError == 0 ) )
            {
               /* Enter key processing. */
               nBlankRcdCount7 = 5 ;
               if ( StringUtil.StrCmp(Gx_mode, "INS") != 0 )
               {
                  /* Display confirmed (stored) records */
                  nRcdExists_7 = 1 ;
                  ScanStart067( ) ;
                  while ( RcdFound7 != 0 )
                  {
                     init_level_properties7( ) ;
                     getByPrimaryKey067( ) ;
                     AddRow067( ) ;
                     ScanNext067( ) ;
                  }
                  ScanEnd067( ) ;
                  nBlankRcdCount7 = 5 ;
               }
            }
            else if ( ( nKeyPressed == 3 ) || ( nKeyPressed == 4 ) || ( ( nKeyPressed == 1 ) && ( AnyError != 0 ) ) )
            {
               /* Button check  or addlines. */
               standaloneNotModal067( ) ;
               standaloneModal067( ) ;
               sMode7 = Gx_mode ;
               while ( nGXsfl_56_idx < nRC_Gridpublicidad_pcosto )
               {
                  ReadRow067( ) ;
                  edtPCostoFecha_Enabled = (int)(context.localUtil.CToN( cgiGet( "PCOSTOFECHA_"+sGXsfl_56_idx+"Enabled"), ",", ".")) ;
                  edtPCostoMonto_Enabled = (int)(context.localUtil.CToN( cgiGet( "PCOSTOMONTO_"+sGXsfl_56_idx+"Enabled"), ",", ".")) ;
                  if ( ( nRcdExists_7 == 0 ) && ( StringUtil.StrCmp(Gx_mode, "INS") != 0 ) )
                  {
                     Gx_mode = "INS" ;
                     context.httpAjaxContext.ajax_rsp_assign_attri("", false, "Gx_mode", Gx_mode);
                     standaloneModal067( ) ;
                  }
                  SendRow067( ) ;
               }
               Gx_mode = sMode7 ;
               context.httpAjaxContext.ajax_rsp_assign_attri("", false, "Gx_mode", Gx_mode);
            }
            else
            {
               /* Get or get-alike key processing. */
               nBlankRcdCount7 = 5 ;
               nRcdExists_7 = 1 ;
               ScanStart067( ) ;
               while ( RcdFound7 != 0 )
               {
                  init_level_properties7( ) ;
                  getByPrimaryKey067( ) ;
                  standaloneNotModal067( ) ;
                  standaloneModal067( ) ;
                  AddRow067( ) ;
                  ScanNext067( ) ;
               }
               ScanEnd067( ) ;
            }
            /* Initialize fields for 'new' records and send them. */
            if ( ( StringUtil.StrCmp(Gx_mode, "DSP") != 0 ) && ( StringUtil.StrCmp(Gx_mode, "DLT") != 0 ) )
            {
               sMode7 = Gx_mode ;
               Gx_mode = "INS" ;
               context.httpAjaxContext.ajax_rsp_assign_attri("", false, "Gx_mode", Gx_mode);
               InitAll067( ) ;
               init_level_properties7( ) ;
               standaloneNotModal067( ) ;
               standaloneModal067( ) ;
               nRcdExists_7 = 0 ;
               nIsMod_7 = 0 ;
               nBlankRcdCount7 = (short)(nBlankRcdUsr7+nBlankRcdCount7) ;
               fRowAdded = 0 ;
               while ( nBlankRcdCount7 > 0 )
               {
                  AddRow067( ) ;
                  if ( ( nKeyPressed == 4 ) && ( fRowAdded == 0 ) )
                  {
                     fRowAdded = 1 ;
                     GX_FocusControl = edtPCostoFecha_Internalname ;
                     context.httpAjaxContext.ajax_rsp_assign_attri("", false, "GX_FocusControl", GX_FocusControl);
                  }
                  nBlankRcdCount7 = (short)(nBlankRcdCount7-1) ;
               }
               Gx_mode = sMode7 ;
               context.httpAjaxContext.ajax_rsp_assign_attri("", false, "Gx_mode", Gx_mode);
            }
            sStyleString = " style=\"display:none;\"" ;
            sStyleString = "" ;
            context.WriteHtmlText( "<div id=\""+"Gridpublicidad_pcostoContainer"+"Div\" "+sStyleString+">"+"</div>") ;
            context.httpAjaxContext.ajax_rsp_assign_grid("_"+"Gridpublicidad_pcosto", (Object)(Gridpublicidad_pcostoContainer));
            if ( ! context.isAjaxRequest( ) )
            {
               GxWebStd.gx_hidden_field( context, "Gridpublicidad_pcostoContainerData", Gridpublicidad_pcostoContainer.ToJavascriptSource());
            }
            if ( context.isAjaxRequest( ) )
            {
               GxWebStd.gx_hidden_field( context, "Gridpublicidad_pcostoContainerData"+"V", Gridpublicidad_pcostoContainer.GridValuesHidden());
            }
            else
            {
               context.WriteHtmlText( "<input type=\"hidden\" "+"name=\""+"Gridpublicidad_pcostoContainerData"+"V"+"\" value='"+Gridpublicidad_pcostoContainer.GridValuesHidden()+"'/>") ;
            }
            context.WriteHtmlText( "</td>") ;
            context.WriteHtmlText( "</tr>") ;
            context.WriteHtmlText( "</tbody>") ;
            /* End of table */
            context.WriteHtmlText( "</table>") ;
            wb_table4_34_066e( true) ;
         }
         else
         {
            wb_table4_34_066e( false) ;
         }
      }

      protected void wb_table5_52_066( bool wbgen )
      {
         if ( wbgen )
         {
            /* Table start */
            sStyleString = "" ;
            GxWebStd.gx_table_start( context, tblTable3_Internalname, tblTable3_Internalname, "", "Table95", 0, "", "", 1, 2, sStyleString, "", 0);
            context.WriteHtmlText( "<tbody>") ;
            context.WriteHtmlText( "<tr>") ;
            context.WriteHtmlText( "<td class=\"SubTitle\" >") ;
            /* Text block */
            ClassString = "" ;
            StyleString = "" ;
            GxWebStd.gx_label_ctrl( context, lblTitlepcosto_Internalname, "PCosto", "", "", lblTitlepcosto_Jsonclick, "", StyleString, ClassString, 0, "", 1, 1, 0, "HLP_Publicidad.htm");
            context.WriteHtmlText( "</td>") ;
            context.WriteHtmlText( "</tr>") ;
            context.WriteHtmlText( "</tbody>") ;
            /* End of table */
            context.WriteHtmlText( "</table>") ;
            wb_table5_52_066e( true) ;
         }
         else
         {
            wb_table5_52_066e( false) ;
         }
      }

      protected void wb_table2_5_066( bool wbgen )
      {
         if ( wbgen )
         {
            /* Table start */
            sStyleString = "" ;
            GxWebStd.gx_table_start( context, tblTabletoolbar_Internalname, tblTabletoolbar_Internalname, "", "ViewTable", 0, "", "", 1, 2, sStyleString, "", 0);
            context.WriteHtmlText( "<tbody>") ;
            context.WriteHtmlText( "<tr>") ;
            context.WriteHtmlText( "<td>") ;
            /* Div Control */
            ClassString = "ToolbarMain" ;
            StyleString = "" ;
            GxWebStd.gx_div_start( context, divSectiontoolbar_Internalname, 1, 0, "px", 0, "px", ClassString);
            /* Active images/pictures */
            TempTags = "  onfocus=\"gx.evt.onfocus(this, 9,'',false,'',0)\"" ;
            ClassString = "ImageHandCenter" ;
            StyleString = "" ;
            GxWebStd.gx_bitmap( context, imgBtn_first_Internalname, context.GetImagePath( "b9e06284-17ac-4c88-8937-5dbd84ad5d80", "", context.GetTheme( )), "", "", "", context.GetTheme( ), imgBtn_first_Visible, 1, "", "Primero", 0, 0, 0, "", 0, "", 0, 0, 5, imgBtn_first_Jsonclick, "EFIRST.", StyleString, ClassString, "", "", ""+TempTags, "", "", 1, false, false, "HLP_Publicidad.htm");
            /* Active images/pictures */
            TempTags = "  onfocus=\"gx.evt.onfocus(this, 10,'',false,'',0)\"" ;
            ClassString = "ImageTop" ;
            StyleString = "" ;
            GxWebStd.gx_bitmap( context, imgBtn_first_separator_Internalname, context.GetImagePath( "ea7811ba-4fa2-42da-8591-e6cb10669f1f", "", context.GetTheme( )), "", "", "", context.GetTheme( ), imgBtn_first_separator_Visible, 1, "", "", 0, 0, 0, "", 0, "", 0, 0, 5, imgBtn_first_separator_Jsonclick, "EFIRST.", StyleString, ClassString, "", "", ""+TempTags, "", "", 1, false, false, "HLP_Publicidad.htm");
            /* Active images/pictures */
            TempTags = "  onfocus=\"gx.evt.onfocus(this, 11,'',false,'',0)\"" ;
            ClassString = "ImageHandCenter" ;
            StyleString = "" ;
            GxWebStd.gx_bitmap( context, imgBtn_previous_Internalname, context.GetImagePath( "7d212604-db7b-4785-9c0d-5faffe71aa33", "", context.GetTheme( )), "", "", "", context.GetTheme( ), imgBtn_previous_Visible, 1, "", "Anterior", 0, 0, 0, "", 0, "", 0, 0, 5, imgBtn_previous_Jsonclick, "EPREVIOUS.", StyleString, ClassString, "", "", ""+TempTags, "", "", 1, false, false, "HLP_Publicidad.htm");
            /* Active images/pictures */
            TempTags = "  onfocus=\"gx.evt.onfocus(this, 12,'',false,'',0)\"" ;
            ClassString = "ImageTop" ;
            StyleString = "" ;
            GxWebStd.gx_bitmap( context, imgBtn_previous_separator_Internalname, context.GetImagePath( "ea7811ba-4fa2-42da-8591-e6cb10669f1f", "", context.GetTheme( )), "", "", "", context.GetTheme( ), imgBtn_previous_separator_Visible, 1, "", "", 0, 0, 0, "", 0, "", 0, 0, 5, imgBtn_previous_separator_Jsonclick, "EPREVIOUS.", StyleString, ClassString, "", "", ""+TempTags, "", "", 1, false, false, "HLP_Publicidad.htm");
            /* Active images/pictures */
            TempTags = "  onfocus=\"gx.evt.onfocus(this, 13,'',false,'',0)\"" ;
            ClassString = "ImageHandCenter" ;
            StyleString = "" ;
            GxWebStd.gx_bitmap( context, imgBtn_next_Internalname, context.GetImagePath( "1ae947cf-1354-41a9-8d59-d91daebf554f", "", context.GetTheme( )), "", "", "", context.GetTheme( ), imgBtn_next_Visible, 1, "", "Siguiente", 0, 0, 0, "", 0, "", 0, 0, 5, imgBtn_next_Jsonclick, "ENEXT.", StyleString, ClassString, "", "", ""+TempTags, "", "", 1, false, false, "HLP_Publicidad.htm");
            /* Active images/pictures */
            TempTags = "  onfocus=\"gx.evt.onfocus(this, 14,'',false,'',0)\"" ;
            ClassString = "ImageTop" ;
            StyleString = "" ;
            GxWebStd.gx_bitmap( context, imgBtn_next_separator_Internalname, context.GetImagePath( "ea7811ba-4fa2-42da-8591-e6cb10669f1f", "", context.GetTheme( )), "", "", "", context.GetTheme( ), imgBtn_next_separator_Visible, 1, "", "", 0, 0, 0, "", 0, "", 0, 0, 5, imgBtn_next_separator_Jsonclick, "ENEXT.", StyleString, ClassString, "", "", ""+TempTags, "", "", 1, false, false, "HLP_Publicidad.htm");
            /* Active images/pictures */
            TempTags = "  onfocus=\"gx.evt.onfocus(this, 15,'',false,'',0)\"" ;
            ClassString = "ImageHandCenter" ;
            StyleString = "" ;
            GxWebStd.gx_bitmap( context, imgBtn_last_Internalname, context.GetImagePath( "29211874-e613-48e5-9011-8017d984217e", "", context.GetTheme( )), "", "", "", context.GetTheme( ), imgBtn_last_Visible, 1, "", "Ultimo", 0, 0, 0, "", 0, "", 0, 0, 5, imgBtn_last_Jsonclick, "ELAST.", StyleString, ClassString, "", "", ""+TempTags, "", "", 1, false, false, "HLP_Publicidad.htm");
            /* Active images/pictures */
            TempTags = "  onfocus=\"gx.evt.onfocus(this, 16,'',false,'',0)\"" ;
            ClassString = "ImageTop" ;
            StyleString = "" ;
            GxWebStd.gx_bitmap( context, imgBtn_last_separator_Internalname, context.GetImagePath( "ea7811ba-4fa2-42da-8591-e6cb10669f1f", "", context.GetTheme( )), "", "", "", context.GetTheme( ), imgBtn_last_separator_Visible, 1, "", "", 0, 0, 0, "", 0, "", 0, 0, 5, imgBtn_last_separator_Jsonclick, "ELAST.", StyleString, ClassString, "", "", ""+TempTags, "", "", 1, false, false, "HLP_Publicidad.htm");
            /* Active images/pictures */
            TempTags = "  onfocus=\"gx.evt.onfocus(this, 17,'',false,'',0)\"" ;
            ClassString = "ImageHandCenter" ;
            StyleString = "" ;
            GxWebStd.gx_bitmap( context, imgBtn_select_Internalname, context.GetImagePath( "1ca03f75-9947-4d2c-90a4-e8ab9c5cedea", "", context.GetTheme( )), "", "", "", context.GetTheme( ), imgBtn_select_Visible, 1, "", "Seleccionar", 0, 0, 0, "", 0, "", 0, 0, 5, imgBtn_select_Jsonclick, "ESELECT.", StyleString, ClassString, "", "", ""+TempTags, "", "", 1, false, false, "HLP_Publicidad.htm");
            /* Active images/pictures */
            TempTags = "  onfocus=\"gx.evt.onfocus(this, 18,'',false,'',0)\"" ;
            ClassString = "ImageTop" ;
            StyleString = "" ;
            GxWebStd.gx_bitmap( context, imgBtn_select_separator_Internalname, context.GetImagePath( "ea7811ba-4fa2-42da-8591-e6cb10669f1f", "", context.GetTheme( )), "", "", "", context.GetTheme( ), imgBtn_select_separator_Visible, 1, "", "", 0, 0, 0, "", 0, "", 0, 0, 5, imgBtn_select_separator_Jsonclick, "ESELECT.", StyleString, ClassString, "", "", ""+TempTags, "", "", 1, false, false, "HLP_Publicidad.htm");
            /* Active images/pictures */
            TempTags = "  onfocus=\"gx.evt.onfocus(this, 19,'',false,'',0)\"" ;
            ClassString = "ImageHandCenter" ;
            StyleString = "" ;
            GxWebStd.gx_bitmap( context, imgBtn_enter2_Internalname, context.GetImagePath( "2061cf2c-bd33-4433-a13e-34af954142e9", "", context.GetTheme( )), "", "", "", context.GetTheme( ), imgBtn_enter2_Visible, imgBtn_enter2_Enabled, "", "Confirmar", 0, 0, 0, "", 0, "", 0, 0, 5, imgBtn_enter2_Jsonclick, "EENTER.", StyleString, ClassString, "", "", ""+TempTags, "", "", 1, false, false, "HLP_Publicidad.htm");
            /* Active images/pictures */
            TempTags = "  onfocus=\"gx.evt.onfocus(this, 20,'',false,'',0)\"" ;
            ClassString = "ImageTop" ;
            StyleString = "" ;
            GxWebStd.gx_bitmap( context, imgBtn_enter2_separator_Internalname, context.GetImagePath( "ea7811ba-4fa2-42da-8591-e6cb10669f1f", "", context.GetTheme( )), "", "", "", context.GetTheme( ), imgBtn_enter2_separator_Visible, 1, "", "", 0, 0, 0, "", 0, "", 0, 0, 5, imgBtn_enter2_separator_Jsonclick, "EENTER.", StyleString, ClassString, "", "", ""+TempTags, "", "", 1, false, false, "HLP_Publicidad.htm");
            /* Active images/pictures */
            TempTags = "  onfocus=\"gx.evt.onfocus(this, 21,'',false,'',0)\"" ;
            ClassString = "ImageHandCenter" ;
            StyleString = "" ;
            GxWebStd.gx_bitmap( context, imgBtn_cancel2_Internalname, context.GetImagePath( "0e94ced8-bc34-47ff-9a53-bc683736a686", "", context.GetTheme( )), "", "", "", context.GetTheme( ), imgBtn_cancel2_Visible, 1, "", "Cancelar", 0, 0, 0, "", 0, "", 0, 0, 1, imgBtn_cancel2_Jsonclick, "ECANCEL.", StyleString, ClassString, "", "", ""+TempTags, "", "", 1, false, false, "HLP_Publicidad.htm");
            /* Active images/pictures */
            TempTags = "  onfocus=\"gx.evt.onfocus(this, 22,'',false,'',0)\"" ;
            ClassString = "ImageTop" ;
            StyleString = "" ;
            GxWebStd.gx_bitmap( context, imgBtn_cancel2_separator_Internalname, context.GetImagePath( "ea7811ba-4fa2-42da-8591-e6cb10669f1f", "", context.GetTheme( )), "", "", "", context.GetTheme( ), imgBtn_cancel2_separator_Visible, 1, "", "", 0, 0, 0, "", 0, "", 0, 0, 1, imgBtn_cancel2_separator_Jsonclick, "ECANCEL.", StyleString, ClassString, "", "", ""+TempTags, "", "", 1, false, false, "HLP_Publicidad.htm");
            /* Active images/pictures */
            TempTags = "  onfocus=\"gx.evt.onfocus(this, 23,'',false,'',0)\"" ;
            ClassString = "ImageHandCenter" ;
            StyleString = "" ;
            GxWebStd.gx_bitmap( context, imgBtn_delete2_Internalname, context.GetImagePath( "7695fe89-52c9-4b7e-871e-0e11548f823e", "", context.GetTheme( )), "", "", "", context.GetTheme( ), imgBtn_delete2_Visible, imgBtn_delete2_Enabled, "", "Eliminar", 0, 0, 0, "", 0, "", 0, 0, 5, imgBtn_delete2_Jsonclick, "EDELETE.", StyleString, ClassString, "", "", ""+TempTags, "", "", 1, false, false, "HLP_Publicidad.htm");
            /* Active images/pictures */
            TempTags = "  onfocus=\"gx.evt.onfocus(this, 24,'',false,'',0)\"" ;
            ClassString = "ImageTop" ;
            StyleString = "" ;
            GxWebStd.gx_bitmap( context, imgBtn_delete2_separator_Internalname, context.GetImagePath( "ea7811ba-4fa2-42da-8591-e6cb10669f1f", "", context.GetTheme( )), "", "", "", context.GetTheme( ), imgBtn_delete2_separator_Visible, 1, "", "", 0, 0, 0, "", 0, "", 0, 0, 5, imgBtn_delete2_separator_Jsonclick, "EDELETE.", StyleString, ClassString, "", "", ""+TempTags, "", "", 1, false, false, "HLP_Publicidad.htm");
            context.WriteHtmlText( "</div>") ;
            context.WriteHtmlText( "</td>") ;
            context.WriteHtmlText( "</tr>") ;
            context.WriteHtmlText( "<tr>") ;
            context.WriteHtmlText( "<td>") ;
            context.WriteHtmlText( "</td>") ;
            context.WriteHtmlText( "</tr>") ;
            context.WriteHtmlText( "</tbody>") ;
            /* End of table */
            context.WriteHtmlText( "</table>") ;
            wb_table2_5_066e( true) ;
         }
         else
         {
            wb_table2_5_066e( false) ;
         }
      }

      protected void UserMain( )
      {
         standaloneStartup( ) ;
      }

      protected void standaloneStartup( )
      {
         standaloneStartupServer( ) ;
         disable_std_buttons( ) ;
         enableDisable( ) ;
         Process( ) ;
      }

      protected void standaloneStartupServer( )
      {
         /* Execute Start event if defined. */
         context.wbGlbDoneStart = 0 ;
         /* Execute user event: E11062 */
         E11062 ();
         context.wbGlbDoneStart = 1 ;
         assign_properties_default( ) ;
         if ( AnyError == 0 )
         {
            if ( StringUtil.StrCmp(context.GetRequestMethod( ), "POST") == 0 )
            {
               /* Read saved SDTs. */
               /* Read variables values. */
               A16PublicidadId = (short)(context.localUtil.CToN( cgiGet( edtPublicidadId_Internalname), ",", ".")) ;
               context.httpAjaxContext.ajax_rsp_assign_attri("", false, "A16PublicidadId", StringUtil.LTrim( StringUtil.Str( (decimal)(A16PublicidadId), 4, 0)));
               A17PublicidadImg = cgiGet( edtPublicidadImg_Internalname) ;
               context.httpAjaxContext.ajax_rsp_assign_attri("", false, "A17PublicidadImg", A17PublicidadImg);
               if ( ( ( context.localUtil.CToN( cgiGet( edtPublicidadDetalle_Internalname), ",", ".") < Convert.ToDecimal( 0 )) ) || ( ( context.localUtil.CToN( cgiGet( edtPublicidadDetalle_Internalname), ",", ".") > Convert.ToDecimal( 9999 )) ) )
               {
                  GX_msglist.addItem(context.GetMessage( "GXM_badnum", ""), 1, "PUBLICIDADDETALLE");
                  AnyError = 1 ;
                  GX_FocusControl = edtPublicidadDetalle_Internalname ;
                  context.httpAjaxContext.ajax_rsp_assign_attri("", false, "GX_FocusControl", GX_FocusControl);
                  wbErr = true ;
                  A41PublicidadDetalle = 0 ;
                  context.httpAjaxContext.ajax_rsp_assign_attri("", false, "A41PublicidadDetalle", StringUtil.LTrim( StringUtil.Str( (decimal)(A41PublicidadDetalle), 4, 0)));
               }
               else
               {
                  A41PublicidadDetalle = (short)(context.localUtil.CToN( cgiGet( edtPublicidadDetalle_Internalname), ",", ".")) ;
                  context.httpAjaxContext.ajax_rsp_assign_attri("", false, "A41PublicidadDetalle", StringUtil.LTrim( StringUtil.Str( (decimal)(A41PublicidadDetalle), 4, 0)));
               }
               /* Read saved values. */
               Z16PublicidadId = (short)(context.localUtil.CToN( cgiGet( "Z16PublicidadId"), ",", ".")) ;
               Z41PublicidadDetalle = (short)(context.localUtil.CToN( cgiGet( "Z41PublicidadDetalle"), ",", ".")) ;
               IsConfirmed = (short)(context.localUtil.CToN( cgiGet( "IsConfirmed"), ",", ".")) ;
               IsModified = (short)(context.localUtil.CToN( cgiGet( "IsModified"), ",", ".")) ;
               Gx_mode = cgiGet( "Mode") ;
               nRC_Gridpublicidad_pcosto = (short)(context.localUtil.CToN( cgiGet( "nRC_Gridpublicidad_pcosto"), ",", ".")) ;
               AV12PublicidadId = (short)(context.localUtil.CToN( cgiGet( "vPUBLICIDADID"), ",", ".")) ;
               AV13Pgmname = cgiGet( "vPGMNAME") ;
               Gx_mode = cgiGet( "vMODE") ;
               edtPublicidadImg_Filename = cgiGet( "PUBLICIDADIMG_Filename") ;
               edtPublicidadImg_Filetype = cgiGet( "PUBLICIDADIMG_Filetype") ;
               /* Read subfile selected row values. */
               /* Read hidden variables. */
               if ( ! String.IsNullOrEmpty(StringUtil.RTrim( A17PublicidadImg)) )
               {
                  edtPublicidadImg_Filename = (String)(CGIGetFileName(edtPublicidadImg_Internalname)) ;
                  edtPublicidadImg_Filetype = (String)(CGIGetFileType(edtPublicidadImg_Internalname)) ;
               }
               if ( String.IsNullOrEmpty(StringUtil.RTrim( A17PublicidadImg)) )
               {
                  A17PublicidadImg = cgiGet( "gxBlobPUBLICIDADIMG") ;
               }
               standaloneNotModal( ) ;
            }
            else
            {
               standaloneNotModal( ) ;
               if ( StringUtil.StrCmp(gxfirstwebparm, "viewer") == 0 )
               {
                  Gx_mode = "DSP" ;
                  context.httpAjaxContext.ajax_rsp_assign_attri("", false, "Gx_mode", Gx_mode);
                  A16PublicidadId = (short)(NumberUtil.Val( GetNextPar( ), ".")) ;
                  context.httpAjaxContext.ajax_rsp_assign_attri("", false, "A16PublicidadId", StringUtil.LTrim( StringUtil.Str( (decimal)(A16PublicidadId), 4, 0)));
                  getEqualNoModal( ) ;
                  Gx_mode = "DSP" ;
                  context.httpAjaxContext.ajax_rsp_assign_attri("", false, "Gx_mode", Gx_mode);
                  disable_std_buttons( ) ;
                  standaloneModal( ) ;
               }
               else
               {
                  if ( StringUtil.StrCmp(Gx_mode, "DSP") == 0 )
                  {
                     sMode6 = Gx_mode ;
                     Gx_mode = "UPD" ;
                     context.httpAjaxContext.ajax_rsp_assign_attri("", false, "Gx_mode", Gx_mode);
                     Gx_mode = sMode6 ;
                     context.httpAjaxContext.ajax_rsp_assign_attri("", false, "Gx_mode", Gx_mode);
                  }
                  standaloneModal( ) ;
                  if ( StringUtil.StrCmp(Gx_mode, "INS") != 0 )
                  {
                     getByPrimaryKey( ) ;
                     if ( RcdFound6 == 1 )
                     {
                        if ( StringUtil.StrCmp(Gx_mode, "DLT") == 0 )
                        {
                           /* Confirm record */
                           CONFIRM_060( ) ;
                           if ( AnyError == 0 )
                           {
                              GX_FocusControl = bttBtn_enter_Internalname ;
                              context.httpAjaxContext.ajax_rsp_assign_attri("", false, "GX_FocusControl", GX_FocusControl);
                           }
                        }
                     }
                     else
                     {
                        GX_msglist.addItem(context.GetMessage( "GXM_noinsert", ""), 1, "PUBLICIDADID");
                        AnyError = 1 ;
                     }
                  }
               }
            }
         }
      }

      protected void Process( )
      {
         if ( StringUtil.StrCmp(context.GetRequestMethod( ), "POST") == 0 )
         {
            /* Read Transaction buttons. */
            sEvt = cgiGet( "_EventName") ;
            EvtGridId = cgiGet( "_EventGridId") ;
            EvtRowId = cgiGet( "_EventRowId") ;
            if ( StringUtil.Len( sEvt) > 0 )
            {
               sEvtType = StringUtil.Left( sEvt, 1) ;
               sEvt = StringUtil.Right( sEvt, (short)(StringUtil.Len( sEvt)-1)) ;
               /* Check if conditions changed and reset current page numbers */
               if ( StringUtil.StrCmp(sEvtType, "M") != 0 )
               {
                  if ( StringUtil.StrCmp(sEvtType, "E") == 0 )
                  {
                     sEvtType = StringUtil.Right( sEvt, 1) ;
                     if ( StringUtil.StrCmp(sEvtType, ".") == 0 )
                     {
                        sEvt = StringUtil.Left( sEvt, (short)(StringUtil.Len( sEvt)-1)) ;
                        if ( StringUtil.StrCmp(sEvt, "START") == 0 )
                        {
                           context.wbHandled = 1 ;
                           dynload_actions( ) ;
                           /* Execute user event: E11062 */
                           E11062 ();
                        }
                        else if ( StringUtil.StrCmp(sEvt, "AFTER TRN") == 0 )
                        {
                           context.wbHandled = 1 ;
                           dynload_actions( ) ;
                           /* Execute user event: E12062 */
                           E12062 ();
                        }
                        else if ( StringUtil.StrCmp(sEvt, "ENTER") == 0 )
                        {
                           context.wbHandled = 1 ;
                           if ( StringUtil.StrCmp(Gx_mode, "DSP") != 0 )
                           {
                              btn_enter( ) ;
                           }
                           /* No code required for Cancel button. It is implemented as the Reset button. */
                        }
                        else if ( StringUtil.StrCmp(sEvt, "FIRST") == 0 )
                        {
                           context.wbHandled = 1 ;
                        }
                        else if ( StringUtil.StrCmp(sEvt, "PREVIOUS") == 0 )
                        {
                           context.wbHandled = 1 ;
                        }
                        else if ( StringUtil.StrCmp(sEvt, "NEXT") == 0 )
                        {
                           context.wbHandled = 1 ;
                        }
                        else if ( StringUtil.StrCmp(sEvt, "LAST") == 0 )
                        {
                           context.wbHandled = 1 ;
                        }
                        else if ( StringUtil.StrCmp(sEvt, "SELECT") == 0 )
                        {
                           context.wbHandled = 1 ;
                        }
                        else if ( StringUtil.StrCmp(sEvt, "DELETE") == 0 )
                        {
                           context.wbHandled = 1 ;
                           if ( StringUtil.StrCmp(Gx_mode, "DSP") != 0 )
                           {
                              btn_delete( ) ;
                           }
                        }
                     }
                     else
                     {
                        sEvtType = StringUtil.Right( sEvt, 4) ;
                        sEvt = StringUtil.Left( sEvt, (short)(StringUtil.Len( sEvt)-4)) ;
                     }
                  }
                  context.wbHandled = 1 ;
               }
            }
         }
      }

      protected void AfterTrn( )
      {
         if ( trnEnded == 1 )
         {
            /* Execute user event: E12062 */
            E12062 ();
            trnEnded = 0 ;
            standaloneNotModal( ) ;
            standaloneModal( ) ;
            if ( ( StringUtil.StrCmp(Gx_mode, "INS") == 0 )  )
            {
               /* Clear variables for new insertion. */
               InitAll066( ) ;
               standaloneNotModal( ) ;
               standaloneModal( ) ;
            }
         }
      }

      public override String ToString( )
      {
         return "" ;
      }

      public GxContentInfo GetContentInfo( )
      {
         return (GxContentInfo)(null) ;
      }

      protected void disable_std_buttons( )
      {
         imgBtn_delete2_Visible = 0 ;
         context.httpAjaxContext.ajax_rsp_assign_prop("", false, imgBtn_delete2_Internalname, "Visible", StringUtil.LTrim( StringUtil.Str( (decimal)(imgBtn_delete2_Visible), 5, 0)));
         imgBtn_delete2_separator_Visible = 0 ;
         context.httpAjaxContext.ajax_rsp_assign_prop("", false, imgBtn_delete2_separator_Internalname, "Visible", StringUtil.LTrim( StringUtil.Str( (decimal)(imgBtn_delete2_separator_Visible), 5, 0)));
         bttBtn_delete_Visible = 0 ;
         context.httpAjaxContext.ajax_rsp_assign_prop("", false, bttBtn_delete_Internalname, "Visible", StringUtil.LTrim( StringUtil.Str( (decimal)(bttBtn_delete_Visible), 5, 0)));
         imgBtn_first_Visible = 0 ;
         context.httpAjaxContext.ajax_rsp_assign_prop("", false, imgBtn_first_Internalname, "Visible", StringUtil.LTrim( StringUtil.Str( (decimal)(imgBtn_first_Visible), 5, 0)));
         imgBtn_first_separator_Visible = 0 ;
         context.httpAjaxContext.ajax_rsp_assign_prop("", false, imgBtn_first_separator_Internalname, "Visible", StringUtil.LTrim( StringUtil.Str( (decimal)(imgBtn_first_separator_Visible), 5, 0)));
         imgBtn_previous_Visible = 0 ;
         context.httpAjaxContext.ajax_rsp_assign_prop("", false, imgBtn_previous_Internalname, "Visible", StringUtil.LTrim( StringUtil.Str( (decimal)(imgBtn_previous_Visible), 5, 0)));
         imgBtn_previous_separator_Visible = 0 ;
         context.httpAjaxContext.ajax_rsp_assign_prop("", false, imgBtn_previous_separator_Internalname, "Visible", StringUtil.LTrim( StringUtil.Str( (decimal)(imgBtn_previous_separator_Visible), 5, 0)));
         imgBtn_next_Visible = 0 ;
         context.httpAjaxContext.ajax_rsp_assign_prop("", false, imgBtn_next_Internalname, "Visible", StringUtil.LTrim( StringUtil.Str( (decimal)(imgBtn_next_Visible), 5, 0)));
         imgBtn_next_separator_Visible = 0 ;
         context.httpAjaxContext.ajax_rsp_assign_prop("", false, imgBtn_next_separator_Internalname, "Visible", StringUtil.LTrim( StringUtil.Str( (decimal)(imgBtn_next_separator_Visible), 5, 0)));
         imgBtn_last_Visible = 0 ;
         context.httpAjaxContext.ajax_rsp_assign_prop("", false, imgBtn_last_Internalname, "Visible", StringUtil.LTrim( StringUtil.Str( (decimal)(imgBtn_last_Visible), 5, 0)));
         imgBtn_last_separator_Visible = 0 ;
         context.httpAjaxContext.ajax_rsp_assign_prop("", false, imgBtn_last_separator_Internalname, "Visible", StringUtil.LTrim( StringUtil.Str( (decimal)(imgBtn_last_separator_Visible), 5, 0)));
         imgBtn_select_Visible = 0 ;
         context.httpAjaxContext.ajax_rsp_assign_prop("", false, imgBtn_select_Internalname, "Visible", StringUtil.LTrim( StringUtil.Str( (decimal)(imgBtn_select_Visible), 5, 0)));
         imgBtn_select_separator_Visible = 0 ;
         context.httpAjaxContext.ajax_rsp_assign_prop("", false, imgBtn_select_separator_Internalname, "Visible", StringUtil.LTrim( StringUtil.Str( (decimal)(imgBtn_select_separator_Visible), 5, 0)));
         if ( ( StringUtil.StrCmp(Gx_mode, "DSP") == 0 ) || ( StringUtil.StrCmp(Gx_mode, "DLT") == 0 ) )
         {
            imgBtn_delete2_Visible = 0 ;
            context.httpAjaxContext.ajax_rsp_assign_prop("", false, imgBtn_delete2_Internalname, "Visible", StringUtil.LTrim( StringUtil.Str( (decimal)(imgBtn_delete2_Visible), 5, 0)));
            imgBtn_delete2_separator_Visible = 0 ;
            context.httpAjaxContext.ajax_rsp_assign_prop("", false, imgBtn_delete2_separator_Internalname, "Visible", StringUtil.LTrim( StringUtil.Str( (decimal)(imgBtn_delete2_separator_Visible), 5, 0)));
            bttBtn_delete_Visible = 0 ;
            context.httpAjaxContext.ajax_rsp_assign_prop("", false, bttBtn_delete_Internalname, "Visible", StringUtil.LTrim( StringUtil.Str( (decimal)(bttBtn_delete_Visible), 5, 0)));
            if ( StringUtil.StrCmp(Gx_mode, "DSP") == 0 )
            {
               imgBtn_enter2_Visible = 0 ;
               context.httpAjaxContext.ajax_rsp_assign_prop("", false, imgBtn_enter2_Internalname, "Visible", StringUtil.LTrim( StringUtil.Str( (decimal)(imgBtn_enter2_Visible), 5, 0)));
               imgBtn_enter2_separator_Visible = 0 ;
               context.httpAjaxContext.ajax_rsp_assign_prop("", false, imgBtn_enter2_separator_Internalname, "Visible", StringUtil.LTrim( StringUtil.Str( (decimal)(imgBtn_enter2_separator_Visible), 5, 0)));
               bttBtn_enter_Visible = 0 ;
               context.httpAjaxContext.ajax_rsp_assign_prop("", false, bttBtn_enter_Internalname, "Visible", StringUtil.LTrim( StringUtil.Str( (decimal)(bttBtn_enter_Visible), 5, 0)));
            }
            DisableAttributes066( ) ;
         }
      }

      protected void set_caption( )
      {
         if ( ( IsConfirmed == 1 ) && ( AnyError == 0 ) )
         {
            if ( StringUtil.StrCmp(Gx_mode, "DLT") == 0 )
            {
               GX_msglist.addItem(context.GetMessage( "GXM_confdelete", ""), 0, "");
            }
            else
            {
               GX_msglist.addItem(context.GetMessage( "GXM_mustconfirm", ""), 0, "");
            }
         }
      }

      protected void CONFIRM_060( )
      {
         BeforeValidate066( ) ;
         if ( AnyError == 0 )
         {
            if ( StringUtil.StrCmp(Gx_mode, "DLT") == 0 )
            {
               OnDeleteControls066( ) ;
            }
            else
            {
               CheckExtendedTable066( ) ;
               CloseExtendedTableCursors066( ) ;
            }
         }
         if ( AnyError == 0 )
         {
            /* Save parent mode. */
            sMode6 = Gx_mode ;
            CONFIRM_067( ) ;
            if ( AnyError == 0 )
            {
               /* Restore parent mode. */
               Gx_mode = sMode6 ;
               context.httpAjaxContext.ajax_rsp_assign_attri("", false, "Gx_mode", Gx_mode);
               IsConfirmed = 1 ;
            }
            /* Restore parent mode. */
            Gx_mode = sMode6 ;
            context.httpAjaxContext.ajax_rsp_assign_attri("", false, "Gx_mode", Gx_mode);
         }
      }

      protected void CONFIRM_067( )
      {
         nGXsfl_56_idx = 0 ;
         while ( nGXsfl_56_idx < nRC_Gridpublicidad_pcosto )
         {
            ReadRow067( ) ;
            if ( ( nRcdExists_7 != 0 ) || ( nIsMod_7 != 0 ) )
            {
               GetKey067( ) ;
               if ( ( nRcdExists_7 == 0 ) && ( nRcdDeleted_7 == 0 ) )
               {
                  if ( RcdFound7 == 0 )
                  {
                     Gx_mode = "INS" ;
                     context.httpAjaxContext.ajax_rsp_assign_attri("", false, "Gx_mode", Gx_mode);
                     BeforeValidate067( ) ;
                     if ( AnyError == 0 )
                     {
                        CheckExtendedTable067( ) ;
                        CloseExtendedTableCursors067( ) ;
                        if ( AnyError == 0 )
                        {
                           IsConfirmed = 1 ;
                        }
                     }
                  }
                  else
                  {
                     GX_msglist.addItem(context.GetMessage( "GXM_noupdate", ""), "DuplicatePrimaryKey", 1, "PCOSTOFECHA");
                     AnyError = 1 ;
                     GX_FocusControl = edtPCostoFecha_Internalname ;
                     context.httpAjaxContext.ajax_rsp_assign_attri("", false, "GX_FocusControl", GX_FocusControl);
                  }
               }
               else
               {
                  if ( RcdFound7 != 0 )
                  {
                     if ( nRcdDeleted_7 != 0 )
                     {
                        Gx_mode = "DLT" ;
                        context.httpAjaxContext.ajax_rsp_assign_attri("", false, "Gx_mode", Gx_mode);
                        getByPrimaryKey067( ) ;
                        Load067( ) ;
                        BeforeValidate067( ) ;
                        if ( AnyError == 0 )
                        {
                           OnDeleteControls067( ) ;
                        }
                     }
                     else
                     {
                        if ( nIsMod_7 != 0 )
                        {
                           Gx_mode = "UPD" ;
                           context.httpAjaxContext.ajax_rsp_assign_attri("", false, "Gx_mode", Gx_mode);
                           BeforeValidate067( ) ;
                           if ( AnyError == 0 )
                           {
                              CheckExtendedTable067( ) ;
                              CloseExtendedTableCursors067( ) ;
                              if ( AnyError == 0 )
                              {
                                 IsConfirmed = 1 ;
                              }
                           }
                        }
                     }
                  }
                  else
                  {
                     if ( nRcdDeleted_7 == 0 )
                     {
                        GX_msglist.addItem(context.GetMessage( "GXM_recdeleted", ""), 1, "PCOSTOFECHA");
                        AnyError = 1 ;
                        GX_FocusControl = edtPCostoFecha_Internalname ;
                        context.httpAjaxContext.ajax_rsp_assign_attri("", false, "GX_FocusControl", GX_FocusControl);
                     }
                  }
               }
            }
            ChangePostValue( edtPCostoFecha_Internalname, context.localUtil.Format(A20PCostoFecha, "99/99/99")) ;
            ChangePostValue( edtPCostoMonto_Internalname, StringUtil.LTrim( StringUtil.NToC( (decimal)(A21PCostoMonto), 4, 0, ",", ""))) ;
            ChangePostValue( "ZT_"+"Z20PCostoFecha_"+sGXsfl_56_idx, context.localUtil.DToC( Z20PCostoFecha, 0, "/")) ;
            ChangePostValue( "ZT_"+"Z21PCostoMonto_"+sGXsfl_56_idx, StringUtil.LTrim( StringUtil.NToC( (decimal)(Z21PCostoMonto), 4, 0, ",", ""))) ;
            ChangePostValue( "nRcdDeleted_7_"+sGXsfl_56_idx, StringUtil.LTrim( StringUtil.NToC( (decimal)(nRcdDeleted_7), 4, 0, ",", ""))) ;
            ChangePostValue( "nRcdExists_7_"+sGXsfl_56_idx, StringUtil.LTrim( StringUtil.NToC( (decimal)(nRcdExists_7), 4, 0, ",", ""))) ;
            ChangePostValue( "nIsMod_7_"+sGXsfl_56_idx, StringUtil.LTrim( StringUtil.NToC( (decimal)(nIsMod_7), 4, 0, ",", ""))) ;
            if ( nIsMod_7 != 0 )
            {
               ChangePostValue( "PCOSTOFECHA_"+sGXsfl_56_idx+"Enabled", StringUtil.LTrim( StringUtil.NToC( (decimal)(edtPCostoFecha_Enabled), 5, 0, ".", ""))) ;
               ChangePostValue( "PCOSTOMONTO_"+sGXsfl_56_idx+"Enabled", StringUtil.LTrim( StringUtil.NToC( (decimal)(edtPCostoMonto_Enabled), 5, 0, ".", ""))) ;
            }
         }
         /* Start of After( level) rules */
         /* End of After( level) rules */
      }

      protected void ResetCaption060( )
      {
      }

      protected void E11062( )
      {
         /* Start Routine */
         new isauthorized(context ).execute(  AV13Pgmname, out  AV9IsAuthorized) ;
         context.httpAjaxContext.ajax_rsp_assign_attri("", false, "AV13Pgmname", AV13Pgmname);
         context.httpAjaxContext.ajax_rsp_assign_attri("", false, "AV9IsAuthorized", StringUtil.BoolToStr( AV9IsAuthorized));
         if ( ! AV9IsAuthorized )
         {
            context.wjLoc = formatLink("notauthorized.aspx") + "?" + UrlEncode(StringUtil.RTrim(AV13Pgmname)) ;
         }
         AV10TrnContext.FromXml(AV11WebSession.Get("TrnContext"), "");
      }

      protected void E12062( )
      {
         /* After Trn Routine */
         if ( ( StringUtil.StrCmp(Gx_mode, "DLT") == 0 ) && ! AV10TrnContext.gxTpr_Callerondelete )
         {
            context.wjLoc = formatLink("wwpublicidad.aspx")  ;
         }
         context.setWebReturnParms(new Object[] {});
         context.nUserReturn = 1 ;
         returnInSub = true;
         if (true) return;
      }

      protected void ZM066( short GX_JID )
      {
         if ( ( GX_JID == 4 ) || ( GX_JID == 0 ) )
         {
            if ( StringUtil.StrCmp(Gx_mode, "INS") != 0 )
            {
               Z41PublicidadDetalle = T00065_A41PublicidadDetalle[0] ;
            }
            else
            {
               Z41PublicidadDetalle = A41PublicidadDetalle ;
            }
         }
         if ( GX_JID == -4 )
         {
            Z16PublicidadId = A16PublicidadId ;
            Z17PublicidadImg = A17PublicidadImg ;
            Z41PublicidadDetalle = A41PublicidadDetalle ;
         }
      }

      protected void standaloneNotModal( )
      {
         edtPublicidadId_Enabled = 0 ;
         context.httpAjaxContext.ajax_rsp_assign_prop("", false, edtPublicidadId_Internalname, "Enabled", StringUtil.LTrim( StringUtil.Str( (decimal)(edtPublicidadId_Enabled), 5, 0)));
         edtPublicidadId_Enabled = 0 ;
         context.httpAjaxContext.ajax_rsp_assign_prop("", false, edtPublicidadId_Internalname, "Enabled", StringUtil.LTrim( StringUtil.Str( (decimal)(edtPublicidadId_Enabled), 5, 0)));
         imgBtn_delete2_Enabled = 0 ;
         context.httpAjaxContext.ajax_rsp_assign_prop("", false, imgBtn_delete2_Internalname, "Enabled", StringUtil.LTrim( StringUtil.Str( (decimal)(imgBtn_delete2_Enabled), 5, 0)));
         if ( ! (0==AV12PublicidadId) )
         {
            A16PublicidadId = AV12PublicidadId ;
            context.httpAjaxContext.ajax_rsp_assign_attri("", false, "A16PublicidadId", StringUtil.LTrim( StringUtil.Str( (decimal)(A16PublicidadId), 4, 0)));
         }
      }

      protected void standaloneModal( )
      {
         if ( StringUtil.StrCmp(Gx_mode, "DSP") == 0 )
         {
            imgBtn_enter2_Enabled = 0 ;
            context.httpAjaxContext.ajax_rsp_assign_prop("", false, imgBtn_enter2_Internalname, "Enabled", StringUtil.LTrim( StringUtil.Str( (decimal)(imgBtn_enter2_Enabled), 5, 0)));
         }
         else
         {
            imgBtn_enter2_Enabled = 1 ;
            context.httpAjaxContext.ajax_rsp_assign_prop("", false, imgBtn_enter2_Internalname, "Enabled", StringUtil.LTrim( StringUtil.Str( (decimal)(imgBtn_enter2_Enabled), 5, 0)));
         }
      }

      protected void Load066( )
      {
         /* Using cursor T00066 */
         pr_default.execute(4, new Object[] {A16PublicidadId});
         if ( (pr_default.getStatus(4) != 101) )
         {
            RcdFound6 = 1 ;
            A41PublicidadDetalle = T00066_A41PublicidadDetalle[0] ;
            context.httpAjaxContext.ajax_rsp_assign_attri("", false, "A41PublicidadDetalle", StringUtil.LTrim( StringUtil.Str( (decimal)(A41PublicidadDetalle), 4, 0)));
            A17PublicidadImg = T00066_A17PublicidadImg[0] ;
            context.httpAjaxContext.ajax_rsp_assign_attri("", false, "A17PublicidadImg", A17PublicidadImg);
            ZM066( -4) ;
         }
         pr_default.close(4);
         OnLoadActions066( ) ;
      }

      protected void OnLoadActions066( )
      {
         AV13Pgmname = "Publicidad" ;
         context.httpAjaxContext.ajax_rsp_assign_attri("", false, "AV13Pgmname", AV13Pgmname);
      }

      protected void CheckExtendedTable066( )
      {
         Gx_BScreen = 1 ;
         standaloneModal( ) ;
         AV13Pgmname = "Publicidad" ;
         context.httpAjaxContext.ajax_rsp_assign_attri("", false, "AV13Pgmname", AV13Pgmname);
      }

      protected void CloseExtendedTableCursors066( )
      {
      }

      protected void enableDisable( )
      {
      }

      protected void GetKey066( )
      {
         /* Using cursor T00067 */
         pr_default.execute(5, new Object[] {A16PublicidadId});
         if ( (pr_default.getStatus(5) != 101) )
         {
            RcdFound6 = 1 ;
         }
         else
         {
            RcdFound6 = 0 ;
         }
         pr_default.close(5);
      }

      protected void getByPrimaryKey( )
      {
         /* Using cursor T00065 */
         pr_default.execute(3, new Object[] {A16PublicidadId});
         if ( (pr_default.getStatus(3) != 101) )
         {
            ZM066( 4) ;
            RcdFound6 = 1 ;
            A16PublicidadId = T00065_A16PublicidadId[0] ;
            context.httpAjaxContext.ajax_rsp_assign_attri("", false, "A16PublicidadId", StringUtil.LTrim( StringUtil.Str( (decimal)(A16PublicidadId), 4, 0)));
            A41PublicidadDetalle = T00065_A41PublicidadDetalle[0] ;
            context.httpAjaxContext.ajax_rsp_assign_attri("", false, "A41PublicidadDetalle", StringUtil.LTrim( StringUtil.Str( (decimal)(A41PublicidadDetalle), 4, 0)));
            A17PublicidadImg = T00065_A17PublicidadImg[0] ;
            context.httpAjaxContext.ajax_rsp_assign_attri("", false, "A17PublicidadImg", A17PublicidadImg);
            Z16PublicidadId = A16PublicidadId ;
            sMode6 = Gx_mode ;
            Gx_mode = "" ;
            context.httpAjaxContext.ajax_rsp_assign_attri("", false, "Gx_mode", Gx_mode);
            Load066( ) ;
            Gx_mode = sMode6 ;
            context.httpAjaxContext.ajax_rsp_assign_attri("", false, "Gx_mode", Gx_mode);
         }
         else
         {
            RcdFound6 = 0 ;
            InitializeNonKey066( ) ;
            sMode6 = Gx_mode ;
            Gx_mode = "" ;
            context.httpAjaxContext.ajax_rsp_assign_attri("", false, "Gx_mode", Gx_mode);
            standaloneModal( ) ;
            Gx_mode = sMode6 ;
            context.httpAjaxContext.ajax_rsp_assign_attri("", false, "Gx_mode", Gx_mode);
         }
         pr_default.close(3);
      }

      protected void getEqualNoModal( )
      {
         GetKey066( ) ;
         if ( RcdFound6 == 0 )
         {
         }
         else
         {
         }
         getByPrimaryKey( ) ;
      }

      protected void move_next( )
      {
         RcdFound6 = 0 ;
         /* Using cursor T00068 */
         pr_default.execute(6, new Object[] {A16PublicidadId});
         if ( (pr_default.getStatus(6) != 101) )
         {
            while ( (pr_default.getStatus(6) != 101) && ( ( T00068_A16PublicidadId[0] < A16PublicidadId ) ) )
            {
               pr_default.readNext(6);
            }
            if ( (pr_default.getStatus(6) != 101) && ( ( T00068_A16PublicidadId[0] > A16PublicidadId ) ) )
            {
               A16PublicidadId = T00068_A16PublicidadId[0] ;
               context.httpAjaxContext.ajax_rsp_assign_attri("", false, "A16PublicidadId", StringUtil.LTrim( StringUtil.Str( (decimal)(A16PublicidadId), 4, 0)));
               RcdFound6 = 1 ;
            }
         }
         pr_default.close(3);
      }

      protected void move_previous( )
      {
         RcdFound6 = 0 ;
         /* Using cursor T00069 */
         pr_default.execute(7, new Object[] {A16PublicidadId});
         if ( (pr_default.getStatus(7) != 101) )
         {
            while ( (pr_default.getStatus(7) != 101) && ( ( T00069_A16PublicidadId[0] > A16PublicidadId ) ) )
            {
               pr_default.readNext(7);
            }
            if ( (pr_default.getStatus(7) != 101) && ( ( T00069_A16PublicidadId[0] < A16PublicidadId ) ) )
            {
               A16PublicidadId = T00069_A16PublicidadId[0] ;
               context.httpAjaxContext.ajax_rsp_assign_attri("", false, "A16PublicidadId", StringUtil.LTrim( StringUtil.Str( (decimal)(A16PublicidadId), 4, 0)));
               RcdFound6 = 1 ;
            }
         }
         pr_default.close(2);
      }

      protected void btn_enter( )
      {
         nKeyPressed = 1 ;
         GetKey066( ) ;
         if ( RcdFound6 == 1 )
         {
            if ( StringUtil.StrCmp(Gx_mode, "INS") == 0 )
            {
               GX_msglist.addItem(context.GetMessage( "GXM_noupdate", ""), "DuplicatePrimaryKey", 1, "PUBLICIDADID");
               AnyError = 1 ;
            }
            else if ( A16PublicidadId != Z16PublicidadId )
            {
               A16PublicidadId = Z16PublicidadId ;
               context.httpAjaxContext.ajax_rsp_assign_attri("", false, "A16PublicidadId", StringUtil.LTrim( StringUtil.Str( (decimal)(A16PublicidadId), 4, 0)));
               GX_msglist.addItem(context.GetMessage( "GXM_getbeforeupd", ""), "CandidateKeyNotFound", 1, "PUBLICIDADID");
               AnyError = 1 ;
            }
            else if ( StringUtil.StrCmp(Gx_mode, "DLT") == 0 )
            {
               delete( ) ;
               AfterTrn( ) ;
               GX_FocusControl = edtPublicidadImg_Internalname ;
               context.httpAjaxContext.ajax_rsp_assign_attri("", false, "GX_FocusControl", GX_FocusControl);
            }
            else
            {
               /* Update record */
               Update066( ) ;
               GX_FocusControl = edtPublicidadImg_Internalname ;
               context.httpAjaxContext.ajax_rsp_assign_attri("", false, "GX_FocusControl", GX_FocusControl);
            }
         }
         else
         {
            if ( A16PublicidadId != Z16PublicidadId )
            {
               /* Insert record */
               GX_FocusControl = edtPublicidadImg_Internalname ;
               context.httpAjaxContext.ajax_rsp_assign_attri("", false, "GX_FocusControl", GX_FocusControl);
               Insert066( ) ;
               if ( AnyError == 1 )
               {
                  GX_FocusControl = "" ;
                  context.httpAjaxContext.ajax_rsp_assign_attri("", false, "GX_FocusControl", GX_FocusControl);
               }
            }
            else
            {
               if ( StringUtil.StrCmp(Gx_mode, "UPD") == 0 )
               {
                  GX_msglist.addItem(context.GetMessage( "GXM_recdeleted", ""), 1, "PUBLICIDADID");
                  AnyError = 1 ;
               }
               else
               {
                  /* Insert record */
                  GX_FocusControl = edtPublicidadImg_Internalname ;
                  context.httpAjaxContext.ajax_rsp_assign_attri("", false, "GX_FocusControl", GX_FocusControl);
                  Insert066( ) ;
                  if ( AnyError == 1 )
                  {
                     GX_FocusControl = "" ;
                     context.httpAjaxContext.ajax_rsp_assign_attri("", false, "GX_FocusControl", GX_FocusControl);
                  }
               }
            }
         }
         AfterTrn( ) ;
         if ( ( StringUtil.StrCmp(Gx_mode, "UPD") == 0 ) || ( StringUtil.StrCmp(Gx_mode, "DLT") == 0 ) )
         {
            if ( AnyError == 0 )
            {
               context.nUserReturn = 1 ;
            }
         }
      }

      protected void btn_delete( )
      {
         if ( A16PublicidadId != Z16PublicidadId )
         {
            A16PublicidadId = Z16PublicidadId ;
            context.httpAjaxContext.ajax_rsp_assign_attri("", false, "A16PublicidadId", StringUtil.LTrim( StringUtil.Str( (decimal)(A16PublicidadId), 4, 0)));
            GX_msglist.addItem(context.GetMessage( "GXM_getbeforedlt", ""), 1, "PUBLICIDADID");
            AnyError = 1 ;
         }
         else
         {
            delete( ) ;
            AfterTrn( ) ;
            GX_FocusControl = edtPublicidadImg_Internalname ;
            context.httpAjaxContext.ajax_rsp_assign_attri("", false, "GX_FocusControl", GX_FocusControl);
         }
         if ( AnyError != 0 )
         {
         }
      }

      protected void CheckOptimisticConcurrency066( )
      {
         if ( StringUtil.StrCmp(Gx_mode, "INS") != 0 )
         {
            /* Using cursor T000610 */
            pr_default.execute(8, new Object[] {A16PublicidadId});
            if ( (pr_default.getStatus(8) == 103) )
            {
               GX_msglist.addItem(context.GetMessage( "GXM_lock", new   object[]  {"Publicidad"}), "RecordIsLocked", 1, "");
               AnyError = 1 ;
               return  ;
            }
            if ( (pr_default.getStatus(8) == 101) || ( Z41PublicidadDetalle != T000610_A41PublicidadDetalle[0] ) )
            {
               GX_msglist.addItem(context.GetMessage( "GXM_waschg", new   object[]  {"Publicidad"}), "RecordWasChanged", 1, "");
               AnyError = 1 ;
               return  ;
            }
         }
      }

      protected void Insert066( )
      {
         BeforeValidate066( ) ;
         if ( AnyError == 0 )
         {
            CheckExtendedTable066( ) ;
         }
         if ( AnyError == 0 )
         {
            ZM066( 0) ;
            CheckOptimisticConcurrency066( ) ;
            if ( AnyError == 0 )
            {
               AfterConfirm066( ) ;
               if ( AnyError == 0 )
               {
                  BeforeInsert066( ) ;
                  if ( AnyError == 0 )
                  {
                     /* Using cursor T000611 */
                     pr_default.execute(9, new Object[] {A17PublicidadImg, A41PublicidadDetalle});
                     pr_default.close(9);
                     /* Retrieving last key number assigned */
                     /* Using cursor T000612 */
                     pr_default.execute(10);
                     A16PublicidadId = T000612_A16PublicidadId[0] ;
                     context.httpAjaxContext.ajax_rsp_assign_attri("", false, "A16PublicidadId", StringUtil.LTrim( StringUtil.Str( (decimal)(A16PublicidadId), 4, 0)));
                     pr_default.close(10);
                     dsDefault.SmartCacheProvider.SetUpdated("Publicidad") ;
                     if ( AnyError == 0 )
                     {
                        /* Start of After( Insert) rules */
                        /* End of After( Insert) rules */
                        if ( AnyError == 0 )
                        {
                           ProcessLevel066( ) ;
                           if ( AnyError == 0 )
                           {
                              /* Save values for previous() function. */
                              GX_msglist.addItem(context.GetMessage( "GXM_sucadded", ""), 0, "");
                              ResetCaption060( ) ;
                           }
                        }
                     }
                  }
                  else
                  {
                     GX_msglist.addItem(context.GetMessage( "GXM_unexp", ""), 1, "");
                     AnyError = 1 ;
                  }
               }
            }
            else
            {
               Load066( ) ;
            }
            EndLevel066( ) ;
         }
         CloseExtendedTableCursors066( ) ;
      }

      protected void Update066( )
      {
         BeforeValidate066( ) ;
         if ( AnyError == 0 )
         {
            CheckExtendedTable066( ) ;
         }
         if ( AnyError == 0 )
         {
            CheckOptimisticConcurrency066( ) ;
            if ( AnyError == 0 )
            {
               AfterConfirm066( ) ;
               if ( AnyError == 0 )
               {
                  BeforeUpdate066( ) ;
                  if ( AnyError == 0 )
                  {
                     /* Using cursor T000613 */
                     pr_default.execute(11, new Object[] {A41PublicidadDetalle, A16PublicidadId});
                     pr_default.close(11);
                     dsDefault.SmartCacheProvider.SetUpdated("Publicidad") ;
                     if ( (pr_default.getStatus(11) == 103) )
                     {
                        GX_msglist.addItem(context.GetMessage( "GXM_lock", new   object[]  {"Publicidad"}), "RecordIsLocked", 1, "");
                        AnyError = 1 ;
                     }
                     DeferredUpdate066( ) ;
                     if ( AnyError == 0 )
                     {
                        /* Start of After( update) rules */
                        /* End of After( update) rules */
                        if ( AnyError == 0 )
                        {
                           ProcessLevel066( ) ;
                           if ( AnyError == 0 )
                           {
                              if ( ( StringUtil.StrCmp(Gx_mode, "UPD") == 0 ) || ( StringUtil.StrCmp(Gx_mode, "DLT") == 0 ) )
                              {
                                 if ( AnyError == 0 )
                                 {
                                    context.nUserReturn = 1 ;
                                 }
                              }
                           }
                        }
                     }
                     else
                     {
                        GX_msglist.addItem(context.GetMessage( "GXM_unexp", ""), 1, "");
                        AnyError = 1 ;
                     }
                  }
               }
            }
            EndLevel066( ) ;
         }
         CloseExtendedTableCursors066( ) ;
      }

      protected void DeferredUpdate066( )
      {
         if ( AnyError == 0 )
         {
            /* Using cursor T000614 */
            pr_default.execute(12, new Object[] {A17PublicidadImg, A16PublicidadId});
            pr_default.close(12);
            dsDefault.SmartCacheProvider.SetUpdated("Publicidad") ;
         }
      }

      protected void delete( )
      {
         BeforeValidate066( ) ;
         if ( AnyError == 0 )
         {
            CheckOptimisticConcurrency066( ) ;
         }
         if ( AnyError == 0 )
         {
            OnDeleteControls066( ) ;
            AfterConfirm066( ) ;
            if ( AnyError == 0 )
            {
               BeforeDelete066( ) ;
               if ( AnyError == 0 )
               {
                  ScanStart067( ) ;
                  while ( RcdFound7 != 0 )
                  {
                     getByPrimaryKey067( ) ;
                     Delete067( ) ;
                     ScanNext067( ) ;
                  }
                  ScanEnd067( ) ;
                  if ( AnyError == 0 )
                  {
                     /* Using cursor T000615 */
                     pr_default.execute(13, new Object[] {A16PublicidadId});
                     pr_default.close(13);
                     dsDefault.SmartCacheProvider.SetUpdated("Publicidad") ;
                     if ( AnyError == 0 )
                     {
                        /* Start of After( delete) rules */
                        /* End of After( delete) rules */
                        if ( AnyError == 0 )
                        {
                           if ( ( StringUtil.StrCmp(Gx_mode, "UPD") == 0 ) || ( StringUtil.StrCmp(Gx_mode, "DLT") == 0 ) )
                           {
                              if ( AnyError == 0 )
                              {
                                 context.nUserReturn = 1 ;
                              }
                           }
                        }
                     }
                     else
                     {
                        GX_msglist.addItem(context.GetMessage( "GXM_unexp", ""), 1, "");
                        AnyError = 1 ;
                     }
                  }
               }
            }
         }
         sMode6 = Gx_mode ;
         Gx_mode = "DLT" ;
         context.httpAjaxContext.ajax_rsp_assign_attri("", false, "Gx_mode", Gx_mode);
         EndLevel066( ) ;
         Gx_mode = sMode6 ;
         context.httpAjaxContext.ajax_rsp_assign_attri("", false, "Gx_mode", Gx_mode);
      }

      protected void OnDeleteControls066( )
      {
         standaloneModal( ) ;
         if ( AnyError == 0 )
         {
            /* Delete mode formulas */
            AV13Pgmname = "Publicidad" ;
            context.httpAjaxContext.ajax_rsp_assign_attri("", false, "AV13Pgmname", AV13Pgmname);
         }
         if ( AnyError == 0 )
         {
            /* Using cursor T000616 */
            pr_default.execute(14, new Object[] {A16PublicidadId});
            if ( (pr_default.getStatus(14) != 101) )
            {
               GX_msglist.addItem(context.GetMessage( "GXM_del", new   object[]  {"Publicidad"}), "CannotDeleteReferencedRecord", 1, "");
               AnyError = 1 ;
            }
            pr_default.close(14);
         }
      }

      protected void ProcessNestedLevel067( )
      {
         nGXsfl_56_idx = 0 ;
         while ( nGXsfl_56_idx < nRC_Gridpublicidad_pcosto )
         {
            ReadRow067( ) ;
            if ( ( nRcdExists_7 != 0 ) || ( nIsMod_7 != 0 ) )
            {
               standaloneNotModal067( ) ;
               GetKey067( ) ;
               if ( ( nRcdExists_7 == 0 ) && ( nRcdDeleted_7 == 0 ) )
               {
                  if ( RcdFound7 == 0 )
                  {
                     Gx_mode = "INS" ;
                     context.httpAjaxContext.ajax_rsp_assign_attri("", false, "Gx_mode", Gx_mode);
                     Insert067( ) ;
                  }
                  else
                  {
                     GX_msglist.addItem(context.GetMessage( "GXM_noupdate", ""), "DuplicatePrimaryKey", 1, "PCOSTOFECHA");
                     AnyError = 1 ;
                     GX_FocusControl = edtPCostoFecha_Internalname ;
                     context.httpAjaxContext.ajax_rsp_assign_attri("", false, "GX_FocusControl", GX_FocusControl);
                  }
               }
               else
               {
                  if ( RcdFound7 != 0 )
                  {
                     if ( ( nRcdDeleted_7 != 0 ) && ( nRcdExists_7 != 0 ) )
                     {
                        Gx_mode = "DLT" ;
                        context.httpAjaxContext.ajax_rsp_assign_attri("", false, "Gx_mode", Gx_mode);
                        Delete067( ) ;
                     }
                     else
                     {
                        if ( ( nIsMod_7 != 0 ) && ( nRcdExists_7 != 0 ) )
                        {
                           Gx_mode = "UPD" ;
                           context.httpAjaxContext.ajax_rsp_assign_attri("", false, "Gx_mode", Gx_mode);
                           Update067( ) ;
                        }
                     }
                  }
                  else
                  {
                     if ( nRcdDeleted_7 == 0 )
                     {
                        GX_msglist.addItem(context.GetMessage( "GXM_recdeleted", ""), 1, "PCOSTOFECHA");
                        AnyError = 1 ;
                        GX_FocusControl = edtPCostoFecha_Internalname ;
                        context.httpAjaxContext.ajax_rsp_assign_attri("", false, "GX_FocusControl", GX_FocusControl);
                     }
                  }
               }
            }
            ChangePostValue( edtPCostoFecha_Internalname, context.localUtil.Format(A20PCostoFecha, "99/99/99")) ;
            ChangePostValue( edtPCostoMonto_Internalname, StringUtil.LTrim( StringUtil.NToC( (decimal)(A21PCostoMonto), 4, 0, ",", ""))) ;
            ChangePostValue( "ZT_"+"Z20PCostoFecha_"+sGXsfl_56_idx, context.localUtil.DToC( Z20PCostoFecha, 0, "/")) ;
            ChangePostValue( "ZT_"+"Z21PCostoMonto_"+sGXsfl_56_idx, StringUtil.LTrim( StringUtil.NToC( (decimal)(Z21PCostoMonto), 4, 0, ",", ""))) ;
            ChangePostValue( "nRcdDeleted_7_"+sGXsfl_56_idx, StringUtil.LTrim( StringUtil.NToC( (decimal)(nRcdDeleted_7), 4, 0, ",", ""))) ;
            ChangePostValue( "nRcdExists_7_"+sGXsfl_56_idx, StringUtil.LTrim( StringUtil.NToC( (decimal)(nRcdExists_7), 4, 0, ",", ""))) ;
            ChangePostValue( "nIsMod_7_"+sGXsfl_56_idx, StringUtil.LTrim( StringUtil.NToC( (decimal)(nIsMod_7), 4, 0, ",", ""))) ;
            if ( nIsMod_7 != 0 )
            {
               ChangePostValue( "PCOSTOFECHA_"+sGXsfl_56_idx+"Enabled", StringUtil.LTrim( StringUtil.NToC( (decimal)(edtPCostoFecha_Enabled), 5, 0, ".", ""))) ;
               ChangePostValue( "PCOSTOMONTO_"+sGXsfl_56_idx+"Enabled", StringUtil.LTrim( StringUtil.NToC( (decimal)(edtPCostoMonto_Enabled), 5, 0, ".", ""))) ;
            }
         }
         /* Start of After( level) rules */
         /* End of After( level) rules */
         InitAll067( ) ;
         if ( AnyError != 0 )
         {
         }
         nRcdExists_7 = 0 ;
         nIsMod_7 = 0 ;
         nRcdDeleted_7 = 0 ;
      }

      protected void ProcessLevel066( )
      {
         /* Save parent mode. */
         sMode6 = Gx_mode ;
         ProcessNestedLevel067( ) ;
         if ( AnyError != 0 )
         {
         }
         /* Restore parent mode. */
         Gx_mode = sMode6 ;
         context.httpAjaxContext.ajax_rsp_assign_attri("", false, "Gx_mode", Gx_mode);
         /* ' Update level parameters */
      }

      protected void EndLevel066( )
      {
         if ( StringUtil.StrCmp(Gx_mode, "INS") != 0 )
         {
            pr_default.close(8);
         }
         if ( AnyError == 0 )
         {
            BeforeComplete066( ) ;
         }
         if ( AnyError == 0 )
         {
            pr_default.close(7);
            pr_default.close(6);
            pr_default.close(1);
            pr_default.close(0);
            context.CommitDataStores("Publicidad");
            if ( AnyError == 0 )
            {
               ConfirmValues060( ) ;
            }
            /* After transaction rules */
            /* Execute 'After Trn' event if defined. */
            trnEnded = 1 ;
         }
         else
         {
            pr_default.close(7);
            pr_default.close(6);
            pr_default.close(1);
            pr_default.close(0);
            context.RollbackDataStores("Publicidad");
         }
         IsModified = 0 ;
         if ( AnyError != 0 )
         {
            context.wjLoc = "" ;
            context.nUserReturn = 0 ;
         }
      }

      public void ScanStart066( )
      {
         /* Scan By routine */
         /* Using cursor T000617 */
         pr_default.execute(15);
         RcdFound6 = 0 ;
         if ( (pr_default.getStatus(15) != 101) )
         {
            RcdFound6 = 1 ;
            A16PublicidadId = T000617_A16PublicidadId[0] ;
            context.httpAjaxContext.ajax_rsp_assign_attri("", false, "A16PublicidadId", StringUtil.LTrim( StringUtil.Str( (decimal)(A16PublicidadId), 4, 0)));
         }
         /* Load Subordinate Levels */
      }

      protected void ScanNext066( )
      {
         /* Scan next routine */
         pr_default.readNext(15);
         RcdFound6 = 0 ;
         if ( (pr_default.getStatus(15) != 101) )
         {
            RcdFound6 = 1 ;
            A16PublicidadId = T000617_A16PublicidadId[0] ;
            context.httpAjaxContext.ajax_rsp_assign_attri("", false, "A16PublicidadId", StringUtil.LTrim( StringUtil.Str( (decimal)(A16PublicidadId), 4, 0)));
         }
      }

      protected void ScanEnd066( )
      {
      }

      protected void AfterConfirm066( )
      {
         /* After Confirm Rules */
      }

      protected void BeforeInsert066( )
      {
         /* Before Insert Rules */
      }

      protected void BeforeUpdate066( )
      {
         /* Before Update Rules */
      }

      protected void BeforeDelete066( )
      {
         /* Before Delete Rules */
      }

      protected void BeforeComplete066( )
      {
         /* Before Complete Rules */
      }

      protected void BeforeValidate066( )
      {
         /* Before Validate Rules */
      }

      protected void DisableAttributes066( )
      {
         edtPublicidadId_Enabled = 0 ;
         context.httpAjaxContext.ajax_rsp_assign_prop("", false, edtPublicidadId_Internalname, "Enabled", StringUtil.LTrim( StringUtil.Str( (decimal)(edtPublicidadId_Enabled), 5, 0)));
         edtPublicidadImg_Enabled = 0 ;
         context.httpAjaxContext.ajax_rsp_assign_prop("", false, edtPublicidadImg_Internalname, "Enabled", StringUtil.LTrim( StringUtil.Str( (decimal)(edtPublicidadImg_Enabled), 5, 0)));
         edtPublicidadDetalle_Enabled = 0 ;
         context.httpAjaxContext.ajax_rsp_assign_prop("", false, edtPublicidadDetalle_Internalname, "Enabled", StringUtil.LTrim( StringUtil.Str( (decimal)(edtPublicidadDetalle_Enabled), 5, 0)));
      }

      protected void ZM067( short GX_JID )
      {
         if ( ( GX_JID == 5 ) || ( GX_JID == 0 ) )
         {
            if ( StringUtil.StrCmp(Gx_mode, "INS") != 0 )
            {
               Z21PCostoMonto = T00063_A21PCostoMonto[0] ;
            }
            else
            {
               Z21PCostoMonto = A21PCostoMonto ;
            }
         }
         if ( GX_JID == -5 )
         {
            Z16PublicidadId = A16PublicidadId ;
            Z20PCostoFecha = A20PCostoFecha ;
            Z21PCostoMonto = A21PCostoMonto ;
         }
      }

      protected void standaloneNotModal067( )
      {
      }

      protected void standaloneModal067( )
      {
         if ( StringUtil.StrCmp(Gx_mode, "INS") != 0 )
         {
            edtPCostoFecha_Enabled = 0 ;
         }
         else
         {
            edtPCostoFecha_Enabled = 1 ;
         }
         if ( ( StringUtil.StrCmp(Gx_mode, "DSP") == 0 ) || ( StringUtil.StrCmp(Gx_mode, "DLT") == 0 ) )
         {
            DisableAttributes067( ) ;
         }
      }

      protected void Load067( )
      {
         /* Using cursor T000618 */
         pr_default.execute(16, new Object[] {A16PublicidadId, A20PCostoFecha});
         if ( (pr_default.getStatus(16) != 101) )
         {
            RcdFound7 = 1 ;
            A21PCostoMonto = T000618_A21PCostoMonto[0] ;
            ZM067( -5) ;
         }
         pr_default.close(16);
         OnLoadActions067( ) ;
      }

      protected void OnLoadActions067( )
      {
      }

      protected void CheckExtendedTable067( )
      {
         Gx_BScreen = 1 ;
         standaloneModal067( ) ;
         if ( ! ( (DateTime.MinValue==A20PCostoFecha) || ( A20PCostoFecha >= context.localUtil.YMDToD( 1753, 1, 1) ) ) )
         {
            GX_msglist.addItem("Campo PCosto Fecha fuera de rango", "OutOfRange", 1, "PCOSTOFECHA");
            AnyError = 1 ;
            GX_FocusControl = edtPCostoFecha_Internalname ;
            context.httpAjaxContext.ajax_rsp_assign_attri("", false, "GX_FocusControl", GX_FocusControl);
         }
      }

      protected void CloseExtendedTableCursors067( )
      {
      }

      protected void enableDisable067( )
      {
      }

      protected void GetKey067( )
      {
         /* Using cursor T000619 */
         pr_default.execute(17, new Object[] {A16PublicidadId, A20PCostoFecha});
         if ( (pr_default.getStatus(17) != 101) )
         {
            RcdFound7 = 1 ;
         }
         else
         {
            RcdFound7 = 0 ;
         }
         pr_default.close(17);
      }

      protected void getByPrimaryKey067( )
      {
         /* Using cursor T00063 */
         pr_default.execute(1, new Object[] {A16PublicidadId, A20PCostoFecha});
         if ( (pr_default.getStatus(1) != 101) )
         {
            ZM067( 5) ;
            RcdFound7 = 1 ;
            InitializeNonKey067( ) ;
            A20PCostoFecha = T00063_A20PCostoFecha[0] ;
            A21PCostoMonto = T00063_A21PCostoMonto[0] ;
            Z16PublicidadId = A16PublicidadId ;
            Z20PCostoFecha = A20PCostoFecha ;
            sMode7 = Gx_mode ;
            Gx_mode = "" ;
            context.httpAjaxContext.ajax_rsp_assign_attri("", false, "Gx_mode", Gx_mode);
            Load067( ) ;
            Gx_mode = sMode7 ;
            context.httpAjaxContext.ajax_rsp_assign_attri("", false, "Gx_mode", Gx_mode);
         }
         else
         {
            RcdFound7 = 0 ;
            InitializeNonKey067( ) ;
            sMode7 = Gx_mode ;
            Gx_mode = "" ;
            context.httpAjaxContext.ajax_rsp_assign_attri("", false, "Gx_mode", Gx_mode);
            standaloneModal067( ) ;
            Gx_mode = sMode7 ;
            context.httpAjaxContext.ajax_rsp_assign_attri("", false, "Gx_mode", Gx_mode);
         }
         pr_default.close(1);
      }

      protected void CheckOptimisticConcurrency067( )
      {
         if ( StringUtil.StrCmp(Gx_mode, "INS") != 0 )
         {
            /* Using cursor T00062 */
            pr_default.execute(0, new Object[] {A16PublicidadId, A20PCostoFecha});
            if ( (pr_default.getStatus(0) == 103) )
            {
               GX_msglist.addItem(context.GetMessage( "GXM_lock", new   object[]  {"PublicidadPCosto"}), "RecordIsLocked", 1, "");
               AnyError = 1 ;
               return  ;
            }
            if ( (pr_default.getStatus(0) == 101) || ( Z21PCostoMonto != T00062_A21PCostoMonto[0] ) )
            {
               GX_msglist.addItem(context.GetMessage( "GXM_waschg", new   object[]  {"PublicidadPCosto"}), "RecordWasChanged", 1, "");
               AnyError = 1 ;
               return  ;
            }
         }
      }

      protected void Insert067( )
      {
         BeforeValidate067( ) ;
         if ( AnyError == 0 )
         {
            CheckExtendedTable067( ) ;
         }
         if ( AnyError == 0 )
         {
            ZM067( 0) ;
            CheckOptimisticConcurrency067( ) ;
            if ( AnyError == 0 )
            {
               AfterConfirm067( ) ;
               if ( AnyError == 0 )
               {
                  BeforeInsert067( ) ;
                  if ( AnyError == 0 )
                  {
                     /* Using cursor T000620 */
                     pr_default.execute(18, new Object[] {A16PublicidadId, A20PCostoFecha, A21PCostoMonto});
                     pr_default.close(18);
                     dsDefault.SmartCacheProvider.SetUpdated("PublicidadPCosto") ;
                     if ( (pr_default.getStatus(18) == 1) )
                     {
                        GX_msglist.addItem(context.GetMessage( "GXM_noupdate", ""), "DuplicatePrimaryKey", 1, "");
                        AnyError = 1 ;
                     }
                     if ( AnyError == 0 )
                     {
                        /* Start of After( Insert) rules */
                        /* End of After( Insert) rules */
                        if ( AnyError == 0 )
                        {
                           /* Save values for previous() function. */
                        }
                     }
                  }
                  else
                  {
                     GX_msglist.addItem(context.GetMessage( "GXM_unexp", ""), 1, "");
                     AnyError = 1 ;
                  }
               }
            }
            else
            {
               Load067( ) ;
            }
            EndLevel067( ) ;
         }
         CloseExtendedTableCursors067( ) ;
      }

      protected void Update067( )
      {
         BeforeValidate067( ) ;
         if ( AnyError == 0 )
         {
            CheckExtendedTable067( ) ;
         }
         if ( AnyError == 0 )
         {
            CheckOptimisticConcurrency067( ) ;
            if ( AnyError == 0 )
            {
               AfterConfirm067( ) ;
               if ( AnyError == 0 )
               {
                  BeforeUpdate067( ) ;
                  if ( AnyError == 0 )
                  {
                     /* Using cursor T000621 */
                     pr_default.execute(19, new Object[] {A21PCostoMonto, A16PublicidadId, A20PCostoFecha});
                     pr_default.close(19);
                     dsDefault.SmartCacheProvider.SetUpdated("PublicidadPCosto") ;
                     if ( (pr_default.getStatus(19) == 103) )
                     {
                        GX_msglist.addItem(context.GetMessage( "GXM_lock", new   object[]  {"PublicidadPCosto"}), "RecordIsLocked", 1, "");
                        AnyError = 1 ;
                     }
                     DeferredUpdate067( ) ;
                     if ( AnyError == 0 )
                     {
                        /* Start of After( update) rules */
                        /* End of After( update) rules */
                        if ( AnyError == 0 )
                        {
                           getByPrimaryKey067( ) ;
                        }
                     }
                     else
                     {
                        GX_msglist.addItem(context.GetMessage( "GXM_unexp", ""), 1, "");
                        AnyError = 1 ;
                     }
                  }
               }
            }
            EndLevel067( ) ;
         }
         CloseExtendedTableCursors067( ) ;
      }

      protected void DeferredUpdate067( )
      {
      }

      protected void Delete067( )
      {
         Gx_mode = "DLT" ;
         context.httpAjaxContext.ajax_rsp_assign_attri("", false, "Gx_mode", Gx_mode);
         BeforeValidate067( ) ;
         if ( AnyError == 0 )
         {
            CheckOptimisticConcurrency067( ) ;
         }
         if ( AnyError == 0 )
         {
            OnDeleteControls067( ) ;
            AfterConfirm067( ) ;
            if ( AnyError == 0 )
            {
               BeforeDelete067( ) ;
               if ( AnyError == 0 )
               {
                  /* No cascading delete specified. */
                  /* Using cursor T000622 */
                  pr_default.execute(20, new Object[] {A16PublicidadId, A20PCostoFecha});
                  pr_default.close(20);
                  dsDefault.SmartCacheProvider.SetUpdated("PublicidadPCosto") ;
                  if ( AnyError == 0 )
                  {
                     /* Start of After( delete) rules */
                     /* End of After( delete) rules */
                  }
                  else
                  {
                     GX_msglist.addItem(context.GetMessage( "GXM_unexp", ""), 1, "");
                     AnyError = 1 ;
                  }
               }
            }
         }
         sMode7 = Gx_mode ;
         Gx_mode = "DLT" ;
         context.httpAjaxContext.ajax_rsp_assign_attri("", false, "Gx_mode", Gx_mode);
         EndLevel067( ) ;
         Gx_mode = sMode7 ;
         context.httpAjaxContext.ajax_rsp_assign_attri("", false, "Gx_mode", Gx_mode);
      }

      protected void OnDeleteControls067( )
      {
         standaloneModal067( ) ;
         /* No delete mode formulas found. */
      }

      protected void EndLevel067( )
      {
         if ( StringUtil.StrCmp(Gx_mode, "INS") != 0 )
         {
            pr_default.close(0);
         }
         if ( AnyError != 0 )
         {
            context.wjLoc = "" ;
            context.nUserReturn = 0 ;
         }
      }

      public void ScanStart067( )
      {
         /* Scan By routine */
         /* Using cursor T000623 */
         pr_default.execute(21, new Object[] {A16PublicidadId});
         RcdFound7 = 0 ;
         if ( (pr_default.getStatus(21) != 101) )
         {
            RcdFound7 = 1 ;
            A20PCostoFecha = T000623_A20PCostoFecha[0] ;
         }
         /* Load Subordinate Levels */
      }

      protected void ScanNext067( )
      {
         /* Scan next routine */
         pr_default.readNext(21);
         RcdFound7 = 0 ;
         if ( (pr_default.getStatus(21) != 101) )
         {
            RcdFound7 = 1 ;
            A20PCostoFecha = T000623_A20PCostoFecha[0] ;
         }
      }

      protected void ScanEnd067( )
      {
         pr_default.close(1);
      }

      protected void AfterConfirm067( )
      {
         /* After Confirm Rules */
      }

      protected void BeforeInsert067( )
      {
         /* Before Insert Rules */
      }

      protected void BeforeUpdate067( )
      {
         /* Before Update Rules */
      }

      protected void BeforeDelete067( )
      {
         /* Before Delete Rules */
      }

      protected void BeforeComplete067( )
      {
         /* Before Complete Rules */
      }

      protected void BeforeValidate067( )
      {
         /* Before Validate Rules */
      }

      protected void DisableAttributes067( )
      {
         edtPCostoFecha_Enabled = 0 ;
         edtPCostoMonto_Enabled = 0 ;
      }

      protected void AddRow067( )
      {
         nGXsfl_56_idx = (short)(nGXsfl_56_idx+1) ;
         sGXsfl_56_idx = StringUtil.PadL( StringUtil.LTrim( StringUtil.Str( (decimal)(nGXsfl_56_idx), 4, 0)), 4, "0") ;
         edtPCostoFecha_Internalname = "PCOSTOFECHA_"+sGXsfl_56_idx ;
         edtPCostoMonto_Internalname = "PCOSTOMONTO_"+sGXsfl_56_idx ;
         SendRow067( ) ;
      }

      protected void SendRow067( )
      {
         Gridpublicidad_pcostoRow = GXWebRow.GetNew(context) ;
         if ( subGridpublicidad_pcosto_Backcolorstyle == 0 )
         {
            /* None style subfile background logic. */
            subGridpublicidad_pcosto_Backstyle = 0 ;
            if ( StringUtil.StrCmp(subGridpublicidad_pcosto_Class, "") != 0 )
            {
               subGridpublicidad_pcosto_Linesclass = subGridpublicidad_pcosto_Class+"Odd" ;
            }
         }
         else if ( subGridpublicidad_pcosto_Backcolorstyle == 1 )
         {
            /* Uniform style subfile background logic. */
            subGridpublicidad_pcosto_Backstyle = 0 ;
            subGridpublicidad_pcosto_Backcolor = subGridpublicidad_pcosto_Allbackcolor ;
            if ( StringUtil.StrCmp(subGridpublicidad_pcosto_Class, "") != 0 )
            {
               subGridpublicidad_pcosto_Linesclass = subGridpublicidad_pcosto_Class+"Uniform" ;
            }
         }
         else if ( subGridpublicidad_pcosto_Backcolorstyle == 2 )
         {
            /* Header style subfile background logic. */
            subGridpublicidad_pcosto_Backstyle = 1 ;
            if ( StringUtil.StrCmp(subGridpublicidad_pcosto_Class, "") != 0 )
            {
               subGridpublicidad_pcosto_Linesclass = subGridpublicidad_pcosto_Class+"Odd" ;
            }
            subGridpublicidad_pcosto_Backcolor = (int)(0xF0F0F0) ;
         }
         else if ( subGridpublicidad_pcosto_Backcolorstyle == 3 )
         {
            /* Report style subfile background logic. */
            subGridpublicidad_pcosto_Backstyle = 1 ;
            if ( ((int)(nGXsfl_56_idx) % (2)) == 0 )
            {
               subGridpublicidad_pcosto_Backcolor = (int)(0x0) ;
               if ( StringUtil.StrCmp(subGridpublicidad_pcosto_Class, "") != 0 )
               {
                  subGridpublicidad_pcosto_Linesclass = subGridpublicidad_pcosto_Class+"Even" ;
               }
            }
            else
            {
               subGridpublicidad_pcosto_Backcolor = (int)(0xF0F0F0) ;
               if ( StringUtil.StrCmp(subGridpublicidad_pcosto_Class, "") != 0 )
               {
                  subGridpublicidad_pcosto_Linesclass = subGridpublicidad_pcosto_Class+"Odd" ;
               }
            }
         }
         /* * Property Link not supported in */
         /* * Property Link not supported in */
         /* Subfile cell */
         /* Single line edit */
         TempTags = " gxoch1=\"gx.fn.setControlValue('nIsMod_7_" + sGXsfl_56_idx + "',1);\"  onfocus=\"gx.evt.onfocus(this, 57,'',false,'" + sGXsfl_56_idx + "',56)\"" ;
         ClassString = "Attribute" ;
         StyleString = "" ;
         ROClassString = ClassString ;
         Gridpublicidad_pcostoRow.AddColumnProperties("edit", 1, isAjaxCallMode( ), new Object[] {(String)edtPCostoFecha_Internalname,context.localUtil.Format(A20PCostoFecha, "99/99/99"),context.localUtil.Format( A20PCostoFecha, "99/99/99"),TempTags+" onchange=\"gx.evt.onchange(this)\" "+" onblur=\""+"gx.date.valid_date(this, 8,'DMY',0,24,'spa',false,0);"+";gx.evt.onblur(57);\"",(String)"",(String)"",(String)"",(String)"",(String)"",(String)edtPCostoFecha_Jsonclick,(short)0,(String)ClassString,(String)StyleString,(String)ROClassString,(short)-1,(int)edtPCostoFecha_Enabled,(short)1,(String)"text",(String)"",(short)0,(String)"px",(short)17,(String)"px",(short)8,(short)0,(short)0,(short)56,(short)1,(short)-1,(bool)true,(String)"",(String)"right"});
         /* Subfile cell */
         /* Single line edit */
         TempTags = " gxoch1=\"gx.fn.setControlValue('nIsMod_7_" + sGXsfl_56_idx + "',1);\"  onfocus=\"gx.evt.onfocus(this, 58,'',false,'" + sGXsfl_56_idx + "',56)\"" ;
         ClassString = "Attribute" ;
         StyleString = "" ;
         ROClassString = ClassString ;
         Gridpublicidad_pcostoRow.AddColumnProperties("edit", 1, isAjaxCallMode( ), new Object[] {(String)edtPCostoMonto_Internalname,StringUtil.LTrim( StringUtil.NToC( (decimal)(A21PCostoMonto), 4, 0, ",", "")),((edtPCostoMonto_Enabled!=0) ? StringUtil.LTrim( context.localUtil.Format( (decimal)(A21PCostoMonto), "ZZZ9")) : context.localUtil.Format( (decimal)(A21PCostoMonto), "ZZZ9")),TempTags+" onchange=\"gx.evt.onchange(this)\" "+" onblur=\""+"gx.num.valid_integer( this,'.');"+";gx.evt.onblur(58);\"",(String)"",(String)"",(String)"",(String)"",(String)"",(String)edtPCostoMonto_Jsonclick,(short)0,(String)ClassString,(String)StyleString,(String)ROClassString,(short)-1,(int)edtPCostoMonto_Enabled,(short)0,(String)"text",(String)"",(short)0,(String)"px",(short)17,(String)"px",(short)4,(short)0,(short)0,(short)56,(short)1,(short)-1,(bool)true,(String)"",(String)"right"});
         context.httpAjaxContext.ajax_sending_grid_row(Gridpublicidad_pcostoRow);
         GXCCtl = "Z20PCostoFecha_" + sGXsfl_56_idx ;
         GxWebStd.gx_hidden_field( context, GXCCtl, context.localUtil.DToC( Z20PCostoFecha, 0, "/"));
         GXCCtl = "Z21PCostoMonto_" + sGXsfl_56_idx ;
         GxWebStd.gx_hidden_field( context, GXCCtl, StringUtil.LTrim( StringUtil.NToC( (decimal)(Z21PCostoMonto), 4, 0, ",", "")));
         GXCCtl = "nRcdDeleted_7_" + sGXsfl_56_idx ;
         GxWebStd.gx_hidden_field( context, GXCCtl, StringUtil.LTrim( StringUtil.NToC( (decimal)(nRcdDeleted_7), 4, 0, ",", "")));
         GXCCtl = "nRcdExists_7_" + sGXsfl_56_idx ;
         GxWebStd.gx_hidden_field( context, GXCCtl, StringUtil.LTrim( StringUtil.NToC( (decimal)(nRcdExists_7), 4, 0, ",", "")));
         GXCCtl = "nIsMod_7_" + sGXsfl_56_idx ;
         GxWebStd.gx_hidden_field( context, GXCCtl, StringUtil.LTrim( StringUtil.NToC( (decimal)(nIsMod_7), 4, 0, ",", "")));
         GXCCtl = "vMODE_" + sGXsfl_56_idx ;
         GxWebStd.gx_hidden_field( context, GXCCtl, StringUtil.RTrim( Gx_mode));
         GXCCtl = "vPUBLICIDADID_" + sGXsfl_56_idx ;
         GxWebStd.gx_hidden_field( context, GXCCtl, StringUtil.LTrim( StringUtil.NToC( (decimal)(AV12PublicidadId), 4, 0, ",", "")));
         GxWebStd.gx_hidden_field( context, "PCOSTOFECHA_"+sGXsfl_56_idx+"Enabled", StringUtil.LTrim( StringUtil.NToC( (decimal)(edtPCostoFecha_Enabled), 5, 0, ".", "")));
         GxWebStd.gx_hidden_field( context, "PCOSTOMONTO_"+sGXsfl_56_idx+"Enabled", StringUtil.LTrim( StringUtil.NToC( (decimal)(edtPCostoMonto_Enabled), 5, 0, ".", "")));
         context.httpAjaxContext.ajax_sending_grid_row(null);
         Gridpublicidad_pcostoContainer.AddRow(Gridpublicidad_pcostoRow);
      }

      protected void ReadRow067( )
      {
         nGXsfl_56_idx = (short)(nGXsfl_56_idx+1) ;
         sGXsfl_56_idx = StringUtil.PadL( StringUtil.LTrim( StringUtil.Str( (decimal)(nGXsfl_56_idx), 4, 0)), 4, "0") ;
         edtPCostoFecha_Internalname = "PCOSTOFECHA_"+sGXsfl_56_idx ;
         edtPCostoMonto_Internalname = "PCOSTOMONTO_"+sGXsfl_56_idx ;
         edtPCostoFecha_Enabled = (int)(context.localUtil.CToN( cgiGet( "PCOSTOFECHA_"+sGXsfl_56_idx+"Enabled"), ",", ".")) ;
         edtPCostoMonto_Enabled = (int)(context.localUtil.CToN( cgiGet( "PCOSTOMONTO_"+sGXsfl_56_idx+"Enabled"), ",", ".")) ;
         if ( context.localUtil.VCDate( cgiGet( edtPCostoFecha_Internalname), 2) == 0 )
         {
            GX_msglist.addItem(context.GetMessage( "GXM_faildate", new   object[]  {"PCosto Fecha"}), 1, "PCOSTOFECHA");
            AnyError = 1 ;
            GX_FocusControl = edtPCostoFecha_Internalname ;
            context.httpAjaxContext.ajax_rsp_assign_attri("", false, "GX_FocusControl", GX_FocusControl);
            wbErr = true ;
            A20PCostoFecha = DateTime.MinValue ;
         }
         else
         {
            A20PCostoFecha = context.localUtil.CToD( cgiGet( edtPCostoFecha_Internalname), 2) ;
         }
         if ( ( ( context.localUtil.CToN( cgiGet( edtPCostoMonto_Internalname), ",", ".") < Convert.ToDecimal( 0 )) ) || ( ( context.localUtil.CToN( cgiGet( edtPCostoMonto_Internalname), ",", ".") > Convert.ToDecimal( 9999 )) ) )
         {
            GX_msglist.addItem(context.GetMessage( "GXM_badnum", ""), 1, "PCOSTOMONTO");
            AnyError = 1 ;
            GX_FocusControl = edtPCostoMonto_Internalname ;
            context.httpAjaxContext.ajax_rsp_assign_attri("", false, "GX_FocusControl", GX_FocusControl);
            wbErr = true ;
            A21PCostoMonto = 0 ;
         }
         else
         {
            A21PCostoMonto = (short)(context.localUtil.CToN( cgiGet( edtPCostoMonto_Internalname), ",", ".")) ;
         }
         GXCCtl = "Z20PCostoFecha_" + sGXsfl_56_idx ;
         Z20PCostoFecha = context.localUtil.CToD( cgiGet( GXCCtl), 0) ;
         GXCCtl = "Z21PCostoMonto_" + sGXsfl_56_idx ;
         Z21PCostoMonto = (short)(context.localUtil.CToN( cgiGet( GXCCtl), ",", ".")) ;
         GXCCtl = "nRcdDeleted_7_" + sGXsfl_56_idx ;
         nRcdDeleted_7 = (short)(context.localUtil.CToN( cgiGet( GXCCtl), ",", ".")) ;
         GXCCtl = "nRcdExists_7_" + sGXsfl_56_idx ;
         nRcdExists_7 = (short)(context.localUtil.CToN( cgiGet( GXCCtl), ",", ".")) ;
         GXCCtl = "nIsMod_7_" + sGXsfl_56_idx ;
         nIsMod_7 = (short)(context.localUtil.CToN( cgiGet( GXCCtl), ",", ".")) ;
         GXCCtl = "vPUBLICIDADID_" + sGXsfl_56_idx ;
         AV12PublicidadId = (short)(context.localUtil.CToN( cgiGet( GXCCtl), ",", ".")) ;
      }

      protected void assign_properties_default( )
      {
         defedtPCostoFecha_Enabled = edtPCostoFecha_Enabled ;
      }

      protected void ConfirmValues060( )
      {
         nGXsfl_56_idx = 0 ;
         sGXsfl_56_idx = StringUtil.PadL( StringUtil.LTrim( StringUtil.Str( (decimal)(nGXsfl_56_idx), 4, 0)), 4, "0") ;
         edtPCostoFecha_Internalname = "PCOSTOFECHA_"+sGXsfl_56_idx ;
         edtPCostoMonto_Internalname = "PCOSTOMONTO_"+sGXsfl_56_idx ;
         while ( nGXsfl_56_idx < nRC_Gridpublicidad_pcosto )
         {
            nGXsfl_56_idx = (short)(nGXsfl_56_idx+1) ;
            sGXsfl_56_idx = StringUtil.PadL( StringUtil.LTrim( StringUtil.Str( (decimal)(nGXsfl_56_idx), 4, 0)), 4, "0") ;
            edtPCostoFecha_Internalname = "PCOSTOFECHA_"+sGXsfl_56_idx ;
            edtPCostoMonto_Internalname = "PCOSTOMONTO_"+sGXsfl_56_idx ;
            ChangePostValue( "Z20PCostoFecha_"+sGXsfl_56_idx, cgiGet( "ZT_"+"Z20PCostoFecha_"+sGXsfl_56_idx)) ;
            DeletePostValue( "ZT_"+"Z20PCostoFecha_"+sGXsfl_56_idx) ;
            ChangePostValue( "Z21PCostoMonto_"+sGXsfl_56_idx, cgiGet( "ZT_"+"Z21PCostoMonto_"+sGXsfl_56_idx)) ;
            DeletePostValue( "ZT_"+"Z21PCostoMonto_"+sGXsfl_56_idx) ;
         }
      }

      public override void RenderHtmlHeaders( )
      {
         GxWebStd.gx_html_headers( context, 0, "", "", Form.Meta, Form.Metaequiv, "IE=EmulateIE7");
      }

      public override void RenderHtmlOpenForm( )
      {
         context.WriteHtmlText( "<title>") ;
         context.WriteHtmlText( Form.Caption) ;
         context.WriteHtmlTextNl( "</title>") ;
         if ( StringUtil.Len( sDynURL) > 0 )
         {
            context.WriteHtmlText( "<BASE href=\""+sDynURL+"\" />") ;
         }
         define_styles( ) ;
         MasterPageObj.master_styles();
         if ( ! context.isSmartDevice( ) )
         {
            context.AddJavascriptSource("gxgral.js", "?"+context.GetBuildNumber( 58381));
            context.AddJavascriptSource("gxcfg.js", "?"+context.GetBuildNumber( 58381));
         }
         else
         {
            context.AddJavascriptSource("gxapiSD.js", "?"+context.GetBuildNumber( 58381));
            context.AddJavascriptSource("gxfxSD.js", "?"+context.GetBuildNumber( 58381));
            context.AddJavascriptSource("gxtypesSD.js", "?"+context.GetBuildNumber( 58381));
            context.AddJavascriptSource("gxpopupSD.js", "?"+context.GetBuildNumber( 58381));
            context.AddJavascriptSource("gxfrmutlSD.js", "?"+context.GetBuildNumber( 58381));
            context.AddJavascriptSource("gxgridSD.js", "?"+context.GetBuildNumber( 58381));
            context.AddJavascriptSource("JavaScripTableSD.js", "?"+context.GetBuildNumber( 58381));
            context.AddJavascriptSource("rijndaelSD.js", "?"+context.GetBuildNumber( 58381));
            context.AddJavascriptSource("gxgralSD.js", "?"+context.GetBuildNumber( 58381));
            context.AddJavascriptSource("gxcfg.js", "?"+context.GetBuildNumber( 58381));
         }
         context.AddJavascriptSource("calendar.js", "?"+context.GetBuildNumber( 58381));
         context.AddJavascriptSource("calendar-setup.js", "?"+context.GetBuildNumber( 58381));
         context.AddJavascriptSource("calendar-es.js", "?"+context.GetBuildNumber( 58381));
         context.WriteHtmlText( Form.Headerrawhtml) ;
         context.CloseHtmlHeader();
         FormProcess = " onkeyup=\"gx.evt.onkeyup(event)\" onkeypress=\"gx.evt.onkeypress(event,true,false)\" onkeydown=\"gx.evt.onkeypress(null,true,false)\"" ;
         context.WriteHtmlText( "<body") ;
         context.WriteHtmlText( " "+"class=\"Form\""+" "+" style=\"-moz-opacity:0;opacity:0;"+"background-color:"+context.BuildHTMLColor( Form.Backcolor)+";") ;
         if ( ! ( String.IsNullOrEmpty(StringUtil.RTrim( Form.Background)) ) )
         {
            context.WriteHtmlText( " background-image:url("+context.convertURL( Form.Background)+")") ;
         }
         context.WriteHtmlText( "\""+FormProcess+">") ;
         context.skipLines(1);
         context.WriteHtmlTextNl( "<form id=\"MAINFORM\" onsubmit=\"try{return gx.csv.validForm()}catch(e){return true;}\" name=\"MAINFORM\" method=\"post\" class=\"Form\" novalidate action=\""+formatLink("publicidad.aspx") + "?" + UrlEncode(StringUtil.RTrim(Gx_mode)) + "," + UrlEncode("" +AV12PublicidadId)+"\">") ;
         GxWebStd.gx_hidden_field( context, "_EventName", "");
         GxWebStd.gx_hidden_field( context, "_EventGridId", "");
         GxWebStd.gx_hidden_field( context, "_EventRowId", "");
      }

      public override void RenderHtmlCloseForm( )
      {
         /* Send hidden variables. */
         /* Send saved values. */
         GxWebStd.gx_hidden_field( context, "Z16PublicidadId", StringUtil.LTrim( StringUtil.NToC( (decimal)(Z16PublicidadId), 4, 0, ",", "")));
         GxWebStd.gx_hidden_field( context, "Z41PublicidadDetalle", StringUtil.LTrim( StringUtil.NToC( (decimal)(Z41PublicidadDetalle), 4, 0, ",", "")));
         GxWebStd.gx_hidden_field( context, "IsConfirmed", StringUtil.LTrim( StringUtil.NToC( (decimal)(IsConfirmed), 4, 0, ",", "")));
         GxWebStd.gx_hidden_field( context, "IsModified", StringUtil.LTrim( StringUtil.NToC( (decimal)(IsModified), 4, 0, ",", "")));
         GxWebStd.gx_hidden_field( context, "Mode", StringUtil.RTrim( Gx_mode));
         GxWebStd.gx_hidden_field( context, "nRC_Gridpublicidad_pcosto", StringUtil.LTrim( StringUtil.NToC( (decimal)(nGXsfl_56_idx), 4, 0, ",", "")));
         GxWebStd.gx_hidden_field( context, "vPUBLICIDADID", StringUtil.LTrim( StringUtil.NToC( (decimal)(AV12PublicidadId), 4, 0, ",", "")));
         GxWebStd.gx_hidden_field( context, "vPGMNAME", StringUtil.RTrim( AV13Pgmname));
         GxWebStd.gx_hidden_field( context, "vMODE", StringUtil.RTrim( Gx_mode));
         GxWebStd.gx_hidden_field( context, "gxBlobPUBLICIDADIMG", StringUtil.RTrim( A17PublicidadImg));
         GxWebStd.gx_hidden_field( context, "PUBLICIDADIMG_Filename", StringUtil.RTrim( edtPublicidadImg_Filename));
         GxWebStd.gx_hidden_field( context, "PUBLICIDADIMG_Filetype", StringUtil.RTrim( edtPublicidadImg_Filetype));
         GxWebStd.gx_hidden_field( context, "GX_FocusControl", GX_FocusControl);
         SendAjaxEncryptionKey();
         SendComponentObjects();
         SendServerCommands();
         SendState();
         context.WriteHtmlTextNl( "</form>") ;
         include_jscripts( ) ;
      }

      public override short ExecuteStartEvent( )
      {
         standaloneStartup( ) ;
         gxajaxcallmode = (short)((isAjaxCallMode( ) ? 1 : 0)) ;
         return gxajaxcallmode ;
      }

      public override void RenderHtmlContent( )
      {
         Draw( ) ;
      }

      public override void DispatchEvents( )
      {
         Process( ) ;
      }

      public override bool HasEnterEvent( )
      {
         return true ;
      }

      public override String GetPgmname( )
      {
         return "Publicidad" ;
      }

      public override String GetPgmdesc( )
      {
         return "Publicidad" ;
      }

      public override GXWebForm GetForm( )
      {
         return Form ;
      }

      public override String GetSelfLink( )
      {
         return formatLink("publicidad.aspx") + "?" + UrlEncode(StringUtil.RTrim(Gx_mode)) + "," + UrlEncode("" +AV12PublicidadId) ;
      }

      protected void InitializeNonKey066( )
      {
         A17PublicidadImg = "" ;
         context.httpAjaxContext.ajax_rsp_assign_attri("", false, "A17PublicidadImg", A17PublicidadImg);
         A41PublicidadDetalle = 0 ;
         context.httpAjaxContext.ajax_rsp_assign_attri("", false, "A41PublicidadDetalle", StringUtil.LTrim( StringUtil.Str( (decimal)(A41PublicidadDetalle), 4, 0)));
      }

      protected void InitAll066( )
      {
         A16PublicidadId = 0 ;
         context.httpAjaxContext.ajax_rsp_assign_attri("", false, "A16PublicidadId", StringUtil.LTrim( StringUtil.Str( (decimal)(A16PublicidadId), 4, 0)));
         InitializeNonKey066( ) ;
      }

      protected void StandaloneModalInsert( )
      {
      }

      protected void InitializeNonKey067( )
      {
         A21PCostoMonto = 0 ;
      }

      protected void InitAll067( )
      {
         A20PCostoFecha = DateTime.MinValue ;
         InitializeNonKey067( ) ;
      }

      protected void StandaloneModalInsert067( )
      {
      }

      protected void define_styles( )
      {
         AddStyleSheetFile("calendar-system.css", "?21265620");
         AddThemeStyleSheetFile("", context.GetTheme( )+".css", "?20412474");
         idxLst = 1 ;
         while ( idxLst <= Form.Jscriptsrc.Count )
         {
            context.AddJavascriptSource(StringUtil.RTrim( Form.Jscriptsrc.Item(idxLst)), "?20128282171640");
            idxLst = (int)(idxLst+1) ;
         }
         /* End function define_styles */
      }

      protected void include_jscripts( )
      {
         context.AddJavascriptSource("messages.spa.js", "?"+context.GetBuildNumber( 58381));
         context.AddJavascriptSource("publicidad.js", "?20128282171641");
         /* End function include_jscripts */
      }

      protected void init_level_properties7( )
      {
         edtPCostoFecha_Enabled = defedtPCostoFecha_Enabled ;
      }

      protected void init_default_properties( )
      {
         imgBtn_first_Internalname = "BTN_FIRST" ;
         imgBtn_first_separator_Internalname = "BTN_FIRST_SEPARATOR" ;
         imgBtn_previous_Internalname = "BTN_PREVIOUS" ;
         imgBtn_previous_separator_Internalname = "BTN_PREVIOUS_SEPARATOR" ;
         imgBtn_next_Internalname = "BTN_NEXT" ;
         imgBtn_next_separator_Internalname = "BTN_NEXT_SEPARATOR" ;
         imgBtn_last_Internalname = "BTN_LAST" ;
         imgBtn_last_separator_Internalname = "BTN_LAST_SEPARATOR" ;
         imgBtn_select_Internalname = "BTN_SELECT" ;
         imgBtn_select_separator_Internalname = "BTN_SELECT_SEPARATOR" ;
         imgBtn_enter2_Internalname = "BTN_ENTER2" ;
         imgBtn_enter2_separator_Internalname = "BTN_ENTER2_SEPARATOR" ;
         imgBtn_cancel2_Internalname = "BTN_CANCEL2" ;
         imgBtn_cancel2_separator_Internalname = "BTN_CANCEL2_SEPARATOR" ;
         imgBtn_delete2_Internalname = "BTN_DELETE2" ;
         imgBtn_delete2_separator_Internalname = "BTN_DELETE2_SEPARATOR" ;
         divSectiontoolbar_Internalname = "SECTIONTOOLBAR" ;
         tblTabletoolbar_Internalname = "TABLETOOLBAR" ;
         lblTextblockpublicidadid_Internalname = "TEXTBLOCKPUBLICIDADID" ;
         edtPublicidadId_Internalname = "PUBLICIDADID" ;
         lblTextblockpublicidadimg_Internalname = "TEXTBLOCKPUBLICIDADIMG" ;
         edtPublicidadImg_Internalname = "PUBLICIDADIMG" ;
         lblTextblockpublicidaddetalle_Internalname = "TEXTBLOCKPUBLICIDADDETALLE" ;
         edtPublicidadDetalle_Internalname = "PUBLICIDADDETALLE" ;
         lblTitlepcosto_Internalname = "TITLEPCOSTO" ;
         tblTable3_Internalname = "TABLE3" ;
         tblTable2_Internalname = "TABLE2" ;
         bttBtn_enter_Internalname = "BTN_ENTER" ;
         bttBtn_cancel_Internalname = "BTN_CANCEL" ;
         bttBtn_delete_Internalname = "BTN_DELETE" ;
         tblTable1_Internalname = "TABLE1" ;
         grpGroupdata_Internalname = "GROUPDATA" ;
         tblTablemain_Internalname = "TABLEMAIN" ;
         Form.Internalname = "FORM" ;
         subGridpublicidad_pcosto_Internalname = "GRIDPUBLICIDAD_PCOSTO" ;
      }

      public override void initialize_properties( )
      {
         init_default_properties( ) ;
         edtPublicidadImg_Filename = "" ;
         Form.Headerrawhtml = "" ;
         Form.Background = "" ;
         Form.Backcolor = (int)(0xFFFFFF) ;
         Form.Caption = "Publicidad" ;
         edtPCostoMonto_Jsonclick = "" ;
         edtPCostoFecha_Jsonclick = "" ;
         subGridpublicidad_pcosto_Class = "Grid" ;
         imgBtn_delete2_separator_Visible = 1 ;
         imgBtn_delete2_Enabled = 1 ;
         imgBtn_delete2_Visible = 1 ;
         imgBtn_cancel2_separator_Visible = 1 ;
         imgBtn_cancel2_Visible = 1 ;
         imgBtn_enter2_separator_Visible = 1 ;
         imgBtn_enter2_Enabled = 1 ;
         imgBtn_enter2_Visible = 1 ;
         imgBtn_select_separator_Visible = 1 ;
         imgBtn_select_Visible = 1 ;
         imgBtn_last_separator_Visible = 1 ;
         imgBtn_last_Visible = 1 ;
         imgBtn_next_separator_Visible = 1 ;
         imgBtn_next_Visible = 1 ;
         imgBtn_previous_separator_Visible = 1 ;
         imgBtn_previous_Visible = 1 ;
         imgBtn_first_separator_Visible = 1 ;
         imgBtn_first_Visible = 1 ;
         subGridpublicidad_pcosto_Allowcollapsing = 0 ;
         subGridpublicidad_pcosto_Allowselection = 0 ;
         edtPCostoMonto_Enabled = 1 ;
         edtPCostoFecha_Enabled = 1 ;
         subGridpublicidad_pcosto_Backcolorstyle = 2 ;
         edtPublicidadDetalle_Jsonclick = "" ;
         edtPublicidadDetalle_Enabled = 1 ;
         edtPublicidadImg_Jsonclick = "" ;
         edtPublicidadImg_Parameters = "" ;
         edtPublicidadImg_Contenttype = "" ;
         edtPublicidadImg_Filetype = "" ;
         edtPublicidadImg_Enabled = 1 ;
         edtPublicidadId_Jsonclick = "" ;
         edtPublicidadId_Enabled = 0 ;
         bttBtn_delete_Visible = 1 ;
         bttBtn_cancel_Visible = 1 ;
         bttBtn_enter_Visible = 1 ;
         context.GX_msglist.DisplayMode = 1 ;
      }

      protected void dynload_actions( )
      {
         /* End function dynload_actions */
      }

      protected void gxnrGridpublicidad_pcosto_newrow( short nRC_Gridpublicidad_pcosto ,
                                                       short nGXsfl_56_idx ,
                                                       String sGXsfl_56_idx )
      {
         GxWebStd.set_html_headers( context, 0, "", "");
         Gx_mode = "INS" ;
         context.httpAjaxContext.ajax_rsp_assign_attri("", false, "Gx_mode", Gx_mode);
         edtPCostoFecha_Internalname = "PCOSTOFECHA_"+sGXsfl_56_idx ;
         edtPCostoMonto_Internalname = "PCOSTOMONTO_"+sGXsfl_56_idx ;
         while ( nGXsfl_56_idx <= nRC_Gridpublicidad_pcosto )
         {
            standaloneNotModal( ) ;
            standaloneModal( ) ;
            standaloneNotModal067( ) ;
            standaloneModal067( ) ;
            dynload_actions( ) ;
            SendRow067( ) ;
            nGXsfl_56_idx = (short)(nGXsfl_56_idx+1) ;
            sGXsfl_56_idx = StringUtil.PadL( StringUtil.LTrim( StringUtil.Str( (decimal)(nGXsfl_56_idx), 4, 0)), 4, "0") ;
            edtPCostoFecha_Internalname = "PCOSTOFECHA_"+sGXsfl_56_idx ;
            edtPCostoMonto_Internalname = "PCOSTOMONTO_"+sGXsfl_56_idx ;
         }
         context.GX_webresponse.AddString(Gridpublicidad_pcostoContainer.ToJavascriptSource());
         /* End function gxnrGridpublicidad_pcosto_newrow */
      }

      public void cleanup( )
      {
         flushBuffer();
         CloseOpenCursors();
         if ( IsMain )
         {
            context.CloseConnections() ;
         }
      }

      protected void CloseOpenCursors( )
      {
         pr_default.close(21);
         pr_default.close(15);
         pr_default.close(7);
         pr_default.close(6);
      }

      public override void initialize( )
      {
         sPrefix = "" ;
         wcpOGx_mode = "" ;
         scmdbuf = "" ;
         gxfirstwebparm = "" ;
         gxfirstwebparm_bkp = "" ;
         PreviousTooltip = "" ;
         PreviousCaption = "" ;
         Form = new GXWebForm();
         GX_FocusControl = "" ;
         sStyleString = "" ;
         ClassString = "" ;
         StyleString = "" ;
         TempTags = "" ;
         bttBtn_enter_Jsonclick = "" ;
         bttBtn_cancel_Jsonclick = "" ;
         bttBtn_delete_Jsonclick = "" ;
         lblTextblockpublicidadid_Jsonclick = "" ;
         lblTextblockpublicidadimg_Jsonclick = "" ;
         gxblobfileaux = new GxFile(context.GetPhysicalPath());
         A17PublicidadImg = "" ;
         lblTextblockpublicidaddetalle_Jsonclick = "" ;
         Gridpublicidad_pcostoContainer = new GXWebGrid( context);
         Gridpublicidad_pcostoColumn = new GXWebColumn();
         A20PCostoFecha = DateTime.MinValue ;
         sMode7 = "" ;
         edtPCostoFecha_Internalname = "" ;
         lblTitlepcosto_Jsonclick = "" ;
         imgBtn_first_Jsonclick = "" ;
         imgBtn_first_separator_Jsonclick = "" ;
         imgBtn_previous_Jsonclick = "" ;
         imgBtn_previous_separator_Jsonclick = "" ;
         imgBtn_next_Jsonclick = "" ;
         imgBtn_next_separator_Jsonclick = "" ;
         imgBtn_last_Jsonclick = "" ;
         imgBtn_last_separator_Jsonclick = "" ;
         imgBtn_select_Jsonclick = "" ;
         imgBtn_select_separator_Jsonclick = "" ;
         imgBtn_enter2_Jsonclick = "" ;
         imgBtn_enter2_separator_Jsonclick = "" ;
         imgBtn_cancel2_Jsonclick = "" ;
         imgBtn_cancel2_separator_Jsonclick = "" ;
         imgBtn_delete2_Jsonclick = "" ;
         imgBtn_delete2_separator_Jsonclick = "" ;
         AV13Pgmname = "" ;
         sMode6 = "" ;
         sEvt = "" ;
         EvtGridId = "" ;
         EvtRowId = "" ;
         sEvtType = "" ;
         edtPCostoMonto_Internalname = "" ;
         Z20PCostoFecha = DateTime.MinValue ;
         AV10TrnContext = new SdtTransactionContext(context);
         AV11WebSession = new GxWebSession( context);
         Z17PublicidadImg = "" ;
         T00066_A16PublicidadId = new short[1] ;
         T00066_A41PublicidadDetalle = new short[1] ;
         T00066_A17PublicidadImg = new String[] {""} ;
         T00067_A16PublicidadId = new short[1] ;
         T00065_A16PublicidadId = new short[1] ;
         T00065_A41PublicidadDetalle = new short[1] ;
         T00065_A17PublicidadImg = new String[] {""} ;
         T00068_A16PublicidadId = new short[1] ;
         T00069_A16PublicidadId = new short[1] ;
         T000610_A16PublicidadId = new short[1] ;
         T000610_A41PublicidadDetalle = new short[1] ;
         T000610_A17PublicidadImg = new String[] {""} ;
         T000612_A16PublicidadId = new short[1] ;
         T000616_A22GuiaId = new short[1] ;
         T000616_A16PublicidadId = new short[1] ;
         T000617_A16PublicidadId = new short[1] ;
         T000618_A16PublicidadId = new short[1] ;
         T000618_A20PCostoFecha = new DateTime[] {DateTime.MinValue} ;
         T000618_A21PCostoMonto = new short[1] ;
         T000619_A16PublicidadId = new short[1] ;
         T000619_A20PCostoFecha = new DateTime[] {DateTime.MinValue} ;
         T00063_A16PublicidadId = new short[1] ;
         T00063_A20PCostoFecha = new DateTime[] {DateTime.MinValue} ;
         T00063_A21PCostoMonto = new short[1] ;
         T00062_A16PublicidadId = new short[1] ;
         T00062_A20PCostoFecha = new DateTime[] {DateTime.MinValue} ;
         T00062_A21PCostoMonto = new short[1] ;
         T000623_A16PublicidadId = new short[1] ;
         T000623_A20PCostoFecha = new DateTime[] {DateTime.MinValue} ;
         Gridpublicidad_pcostoRow = new GXWebRow();
         subGridpublicidad_pcosto_Linesclass = "" ;
         ROClassString = "" ;
         GXCCtl = "" ;
         sDynURL = "" ;
         FormProcess = "" ;
         pr_default = new DataStoreProvider(context, new GeneXus.Programs.publicidad__default(),
            new Object[][] {
                new Object[] {
               T00062_A16PublicidadId, T00062_A20PCostoFecha, T00062_A21PCostoMonto
               }
               , new Object[] {
               T00063_A16PublicidadId, T00063_A20PCostoFecha, T00063_A21PCostoMonto
               }
               , new Object[] {
               T00064_A16PublicidadId, T00064_A41PublicidadDetalle, T00064_A17PublicidadImg
               }
               , new Object[] {
               T00065_A16PublicidadId, T00065_A41PublicidadDetalle, T00065_A17PublicidadImg
               }
               , new Object[] {
               T00066_A16PublicidadId, T00066_A41PublicidadDetalle, T00066_A17PublicidadImg
               }
               , new Object[] {
               T00067_A16PublicidadId
               }
               , new Object[] {
               T00068_A16PublicidadId
               }
               , new Object[] {
               T00069_A16PublicidadId
               }
               , new Object[] {
               T000610_A16PublicidadId, T000610_A41PublicidadDetalle, T000610_A17PublicidadImg
               }
               , new Object[] {
               }
               , new Object[] {
               T000612_A16PublicidadId
               }
               , new Object[] {
               }
               , new Object[] {
               }
               , new Object[] {
               }
               , new Object[] {
               T000616_A22GuiaId, T000616_A16PublicidadId
               }
               , new Object[] {
               T000617_A16PublicidadId
               }
               , new Object[] {
               T000618_A16PublicidadId, T000618_A20PCostoFecha, T000618_A21PCostoMonto
               }
               , new Object[] {
               T000619_A16PublicidadId, T000619_A20PCostoFecha
               }
               , new Object[] {
               }
               , new Object[] {
               }
               , new Object[] {
               }
               , new Object[] {
               T000623_A16PublicidadId, T000623_A20PCostoFecha
               }
            }
         );
         AV13Pgmname = "Publicidad" ;
      }

      private short wcpOAV12PublicidadId ;
      private short GxWebError ;
      private short nRC_Gridpublicidad_pcosto ;
      private short nGXsfl_56_idx=1 ;
      private short AV12PublicidadId ;
      private short IsConfirmed ;
      private short IsModified ;
      private short AnyError ;
      private short nKeyPressed ;
      private short initialized ;
      private short A16PublicidadId ;
      private short A41PublicidadDetalle ;
      private short subGridpublicidad_pcosto_Backcolorstyle ;
      private short A21PCostoMonto ;
      private short subGridpublicidad_pcosto_Allowselection ;
      private short subGridpublicidad_pcosto_Allowhovering ;
      private short subGridpublicidad_pcosto_Allowcollapsing ;
      private short subGridpublicidad_pcosto_Collapsed ;
      private short nBlankRcdCount7 ;
      private short nRcdExists_7 ;
      private short RcdFound7 ;
      private short nIsMod_7 ;
      private short nBlankRcdUsr7 ;
      private short Z16PublicidadId ;
      private short Z41PublicidadDetalle ;
      private short RcdFound6 ;
      private short nRcdDeleted_7 ;
      private short Z21PCostoMonto ;
      private short GX_JID ;
      private short Gx_BScreen ;
      private short subGridpublicidad_pcosto_Backstyle ;
      private short gxajaxcallmode ;
      private int trnEnded ;
      private int bttBtn_enter_Visible ;
      private int bttBtn_cancel_Visible ;
      private int bttBtn_delete_Visible ;
      private int edtPublicidadId_Enabled ;
      private int edtPublicidadImg_Enabled ;
      private int edtPublicidadDetalle_Enabled ;
      private int edtPCostoFecha_Enabled ;
      private int edtPCostoMonto_Enabled ;
      private int subGridpublicidad_pcosto_Selectioncolor ;
      private int subGridpublicidad_pcosto_Hoveringcolor ;
      private int fRowAdded ;
      private int imgBtn_first_Visible ;
      private int imgBtn_first_separator_Visible ;
      private int imgBtn_previous_Visible ;
      private int imgBtn_previous_separator_Visible ;
      private int imgBtn_next_Visible ;
      private int imgBtn_next_separator_Visible ;
      private int imgBtn_last_Visible ;
      private int imgBtn_last_separator_Visible ;
      private int imgBtn_select_Visible ;
      private int imgBtn_select_separator_Visible ;
      private int imgBtn_enter2_Visible ;
      private int imgBtn_enter2_Enabled ;
      private int imgBtn_enter2_separator_Visible ;
      private int imgBtn_cancel2_Visible ;
      private int imgBtn_cancel2_separator_Visible ;
      private int imgBtn_delete2_Visible ;
      private int imgBtn_delete2_Enabled ;
      private int imgBtn_delete2_separator_Visible ;
      private int GRIDPUBLICIDAD_PCOSTO_nFirstRecordOnPage ;
      private int subGridpublicidad_pcosto_Backcolor ;
      private int subGridpublicidad_pcosto_Allbackcolor ;
      private int defedtPCostoFecha_Enabled ;
      private int idxLst ;
      private String sPrefix ;
      private String wcpOGx_mode ;
      private String scmdbuf ;
      private String gxfirstwebparm ;
      private String gxfirstwebparm_bkp ;
      private String sGXsfl_56_idx="0001" ;
      private String Gx_mode ;
      private String PreviousTooltip ;
      private String PreviousCaption ;
      private String GX_FocusControl ;
      private String edtPublicidadImg_Internalname ;
      private String sStyleString ;
      private String tblTablemain_Internalname ;
      private String ClassString ;
      private String StyleString ;
      private String grpGroupdata_Internalname ;
      private String tblTable1_Internalname ;
      private String TempTags ;
      private String bttBtn_enter_Internalname ;
      private String bttBtn_enter_Jsonclick ;
      private String bttBtn_cancel_Internalname ;
      private String bttBtn_cancel_Jsonclick ;
      private String bttBtn_delete_Internalname ;
      private String bttBtn_delete_Jsonclick ;
      private String tblTable2_Internalname ;
      private String lblTextblockpublicidadid_Internalname ;
      private String lblTextblockpublicidadid_Jsonclick ;
      private String edtPublicidadId_Internalname ;
      private String edtPublicidadId_Jsonclick ;
      private String lblTextblockpublicidadimg_Internalname ;
      private String lblTextblockpublicidadimg_Jsonclick ;
      private String edtPublicidadImg_Filetype ;
      private String edtPublicidadImg_Contenttype ;
      private String edtPublicidadImg_Parameters ;
      private String edtPublicidadImg_Jsonclick ;
      private String lblTextblockpublicidaddetalle_Internalname ;
      private String lblTextblockpublicidaddetalle_Jsonclick ;
      private String edtPublicidadDetalle_Internalname ;
      private String edtPublicidadDetalle_Jsonclick ;
      private String sMode7 ;
      private String edtPCostoFecha_Internalname ;
      private String tblTable3_Internalname ;
      private String lblTitlepcosto_Internalname ;
      private String lblTitlepcosto_Jsonclick ;
      private String tblTabletoolbar_Internalname ;
      private String divSectiontoolbar_Internalname ;
      private String imgBtn_first_Internalname ;
      private String imgBtn_first_Jsonclick ;
      private String imgBtn_first_separator_Internalname ;
      private String imgBtn_first_separator_Jsonclick ;
      private String imgBtn_previous_Internalname ;
      private String imgBtn_previous_Jsonclick ;
      private String imgBtn_previous_separator_Internalname ;
      private String imgBtn_previous_separator_Jsonclick ;
      private String imgBtn_next_Internalname ;
      private String imgBtn_next_Jsonclick ;
      private String imgBtn_next_separator_Internalname ;
      private String imgBtn_next_separator_Jsonclick ;
      private String imgBtn_last_Internalname ;
      private String imgBtn_last_Jsonclick ;
      private String imgBtn_last_separator_Internalname ;
      private String imgBtn_last_separator_Jsonclick ;
      private String imgBtn_select_Internalname ;
      private String imgBtn_select_Jsonclick ;
      private String imgBtn_select_separator_Internalname ;
      private String imgBtn_select_separator_Jsonclick ;
      private String imgBtn_enter2_Internalname ;
      private String imgBtn_enter2_Jsonclick ;
      private String imgBtn_enter2_separator_Internalname ;
      private String imgBtn_enter2_separator_Jsonclick ;
      private String imgBtn_cancel2_Internalname ;
      private String imgBtn_cancel2_Jsonclick ;
      private String imgBtn_cancel2_separator_Internalname ;
      private String imgBtn_cancel2_separator_Jsonclick ;
      private String imgBtn_delete2_Internalname ;
      private String imgBtn_delete2_Jsonclick ;
      private String imgBtn_delete2_separator_Internalname ;
      private String imgBtn_delete2_separator_Jsonclick ;
      private String AV13Pgmname ;
      private String edtPublicidadImg_Filename ;
      private String sMode6 ;
      private String sEvt ;
      private String EvtGridId ;
      private String EvtRowId ;
      private String sEvtType ;
      private String edtPCostoMonto_Internalname ;
      private String subGridpublicidad_pcosto_Class ;
      private String subGridpublicidad_pcosto_Linesclass ;
      private String ROClassString ;
      private String edtPCostoFecha_Jsonclick ;
      private String edtPCostoMonto_Jsonclick ;
      private String GXCCtl ;
      private String sDynURL ;
      private String FormProcess ;
      private String subGridpublicidad_pcosto_Internalname ;
      private DateTime A20PCostoFecha ;
      private DateTime Z20PCostoFecha ;
      private bool entryPointCalled ;
      private bool wbErr ;
      private bool AV9IsAuthorized ;
      private bool returnInSub ;
      private String A17PublicidadImg ;
      private String Z17PublicidadImg ;
      private GxWebSession AV11WebSession ;
      private GxFile gxblobfileaux ;
      private GXMasterPage MasterPageObj ;
      private GXWebGrid Gridpublicidad_pcostoContainer ;
      private GXWebRow Gridpublicidad_pcostoRow ;
      private GXWebColumn Gridpublicidad_pcostoColumn ;
      private IGxDataStore dsDefault ;
      private IDataStoreProvider pr_default ;
      private short[] T00066_A16PublicidadId ;
      private short[] T00066_A41PublicidadDetalle ;
      private String[] T00066_A17PublicidadImg ;
      private short[] T00067_A16PublicidadId ;
      private short[] T00065_A16PublicidadId ;
      private short[] T00065_A41PublicidadDetalle ;
      private String[] T00065_A17PublicidadImg ;
      private short[] T00068_A16PublicidadId ;
      private short[] T00069_A16PublicidadId ;
      private short[] T000610_A16PublicidadId ;
      private short[] T000610_A41PublicidadDetalle ;
      private String[] T000610_A17PublicidadImg ;
      private short[] T000612_A16PublicidadId ;
      private short[] T000616_A22GuiaId ;
      private short[] T000616_A16PublicidadId ;
      private short[] T000617_A16PublicidadId ;
      private short[] T000618_A16PublicidadId ;
      private DateTime[] T000618_A20PCostoFecha ;
      private short[] T000618_A21PCostoMonto ;
      private short[] T000619_A16PublicidadId ;
      private DateTime[] T000619_A20PCostoFecha ;
      private short[] T00063_A16PublicidadId ;
      private DateTime[] T00063_A20PCostoFecha ;
      private short[] T00063_A21PCostoMonto ;
      private short[] T00062_A16PublicidadId ;
      private DateTime[] T00062_A20PCostoFecha ;
      private short[] T00062_A21PCostoMonto ;
      private short[] T000623_A16PublicidadId ;
      private DateTime[] T000623_A20PCostoFecha ;
      private short[] T00064_A16PublicidadId ;
      private short[] T00064_A41PublicidadDetalle ;
      private String[] T00064_A17PublicidadImg ;
      private GXWebForm Form ;
      private SdtTransactionContext AV10TrnContext ;
   }

   public class publicidad__default : DataStoreHelperBase, IDataStoreHelper
   {
      public ICursor[] getCursors( )
      {
         cursorDefinitions();
         return new Cursor[] {
          new ForEachCursor(def[0])
         ,new ForEachCursor(def[1])
         ,new ForEachCursor(def[2])
         ,new ForEachCursor(def[3])
         ,new ForEachCursor(def[4])
         ,new ForEachCursor(def[5])
         ,new ForEachCursor(def[6])
         ,new ForEachCursor(def[7])
         ,new ForEachCursor(def[8])
         ,new UpdateCursor(def[9])
         ,new ForEachCursor(def[10])
         ,new UpdateCursor(def[11])
         ,new UpdateCursor(def[12])
         ,new UpdateCursor(def[13])
         ,new ForEachCursor(def[14])
         ,new ForEachCursor(def[15])
         ,new ForEachCursor(def[16])
         ,new ForEachCursor(def[17])
         ,new UpdateCursor(def[18])
         ,new UpdateCursor(def[19])
         ,new UpdateCursor(def[20])
         ,new ForEachCursor(def[21])
       };
    }

    private static CursorDef[] def;
    private void cursorDefinitions( )
    {
       if ( def == null )
       {
          Object[] prmT00064 ;
          prmT00064 = new Object[] {
          new Object[] {"@PublicidadId",SqlDbType.SmallInt,4,0}
          } ;
          Object[] prmT00066 ;
          prmT00066 = new Object[] {
          new Object[] {"@PublicidadId",SqlDbType.SmallInt,4,0}
          } ;
          Object[] prmT00067 ;
          prmT00067 = new Object[] {
          new Object[] {"@PublicidadId",SqlDbType.SmallInt,4,0}
          } ;
          Object[] prmT00065 ;
          prmT00065 = new Object[] {
          new Object[] {"@PublicidadId",SqlDbType.SmallInt,4,0}
          } ;
          Object[] prmT00068 ;
          prmT00068 = new Object[] {
          new Object[] {"@PublicidadId",SqlDbType.SmallInt,4,0}
          } ;
          Object[] prmT00069 ;
          prmT00069 = new Object[] {
          new Object[] {"@PublicidadId",SqlDbType.SmallInt,4,0}
          } ;
          Object[] prmT000610 ;
          prmT000610 = new Object[] {
          new Object[] {"@PublicidadId",SqlDbType.SmallInt,4,0}
          } ;
          Object[] prmT000611 ;
          prmT000611 = new Object[] {
          new Object[] {"@PublicidadImg",SqlDbType.VarBinary,1024,0} ,
          new Object[] {"@PublicidadDetalle",SqlDbType.SmallInt,4,0}
          } ;
          Object[] prmT000612 ;
          prmT000612 = new Object[] {
          } ;
          Object[] prmT000613 ;
          prmT000613 = new Object[] {
          new Object[] {"@PublicidadDetalle",SqlDbType.SmallInt,4,0} ,
          new Object[] {"@PublicidadId",SqlDbType.SmallInt,4,0}
          } ;
          Object[] prmT000614 ;
          prmT000614 = new Object[] {
          new Object[] {"@PublicidadImg",SqlDbType.VarBinary,1024,0} ,
          new Object[] {"@PublicidadId",SqlDbType.SmallInt,4,0}
          } ;
          Object[] prmT000615 ;
          prmT000615 = new Object[] {
          new Object[] {"@PublicidadId",SqlDbType.SmallInt,4,0}
          } ;
          Object[] prmT000616 ;
          prmT000616 = new Object[] {
          new Object[] {"@PublicidadId",SqlDbType.SmallInt,4,0}
          } ;
          Object[] prmT000617 ;
          prmT000617 = new Object[] {
          } ;
          Object[] prmT000618 ;
          prmT000618 = new Object[] {
          new Object[] {"@PublicidadId",SqlDbType.SmallInt,4,0} ,
          new Object[] {"@PCostoFecha",SqlDbType.DateTime,8,0}
          } ;
          Object[] prmT000619 ;
          prmT000619 = new Object[] {
          new Object[] {"@PublicidadId",SqlDbType.SmallInt,4,0} ,
          new Object[] {"@PCostoFecha",SqlDbType.DateTime,8,0}
          } ;
          Object[] prmT00063 ;
          prmT00063 = new Object[] {
          new Object[] {"@PublicidadId",SqlDbType.SmallInt,4,0} ,
          new Object[] {"@PCostoFecha",SqlDbType.DateTime,8,0}
          } ;
          Object[] prmT00062 ;
          prmT00062 = new Object[] {
          new Object[] {"@PublicidadId",SqlDbType.SmallInt,4,0} ,
          new Object[] {"@PCostoFecha",SqlDbType.DateTime,8,0}
          } ;
          Object[] prmT000620 ;
          prmT000620 = new Object[] {
          new Object[] {"@PublicidadId",SqlDbType.SmallInt,4,0} ,
          new Object[] {"@PCostoFecha",SqlDbType.DateTime,8,0} ,
          new Object[] {"@PCostoMonto",SqlDbType.SmallInt,4,0}
          } ;
          Object[] prmT000621 ;
          prmT000621 = new Object[] {
          new Object[] {"@PCostoMonto",SqlDbType.SmallInt,4,0} ,
          new Object[] {"@PublicidadId",SqlDbType.SmallInt,4,0} ,
          new Object[] {"@PCostoFecha",SqlDbType.DateTime,8,0}
          } ;
          Object[] prmT000622 ;
          prmT000622 = new Object[] {
          new Object[] {"@PublicidadId",SqlDbType.SmallInt,4,0} ,
          new Object[] {"@PCostoFecha",SqlDbType.DateTime,8,0}
          } ;
          Object[] prmT000623 ;
          prmT000623 = new Object[] {
          new Object[] {"@PublicidadId",SqlDbType.SmallInt,4,0}
          } ;
          def= new CursorDef[] {
              new CursorDef("T00062", "SELECT [PublicidadId], [PCostoFecha], [PCostoMonto] FROM [PublicidadPCosto] WITH (UPDLOCK) WHERE [PublicidadId] = @PublicidadId AND [PCostoFecha] = @PCostoFecha ",true, GxErrorMask.GX_NOMASK, false, this,prmT00062,1,0,true,false )
             ,new CursorDef("T00063", "SELECT [PublicidadId], [PCostoFecha], [PCostoMonto] FROM [PublicidadPCosto] WITH (NOLOCK) WHERE [PublicidadId] = @PublicidadId AND [PCostoFecha] = @PCostoFecha ",true, GxErrorMask.GX_NOMASK, false, this,prmT00063,1,0,true,false )
             ,new CursorDef("T00064", "SELECT [PublicidadId], [PublicidadDetalle], [PublicidadImg] FROM [Publicidad] WITH (UPDLOCK) WHERE [PublicidadId] = @PublicidadId ",true, GxErrorMask.GX_NOMASK, false, this,prmT00064,1,0,true,false )
             ,new CursorDef("T00065", "SELECT [PublicidadId], [PublicidadDetalle], [PublicidadImg] FROM [Publicidad] WITH (NOLOCK) WHERE [PublicidadId] = @PublicidadId ",true, GxErrorMask.GX_NOMASK, false, this,prmT00065,1,0,true,false )
             ,new CursorDef("T00066", "SELECT TM1.[PublicidadId], TM1.[PublicidadDetalle], TM1.[PublicidadImg] FROM [Publicidad] TM1 WITH (NOLOCK) WHERE TM1.[PublicidadId] = @PublicidadId ORDER BY TM1.[PublicidadId]  OPTION (FAST 100)",true, GxErrorMask.GX_NOMASK, false, this,prmT00066,100,0,true,false )
             ,new CursorDef("T00067", "SELECT [PublicidadId] FROM [Publicidad] WITH (NOLOCK) WHERE [PublicidadId] = @PublicidadId  OPTION (FAST 1)",true, GxErrorMask.GX_NOMASK, false, this,prmT00067,1,0,true,false )
             ,new CursorDef("T00068", "SELECT TOP 1 [PublicidadId] FROM [Publicidad] WITH (NOLOCK) WHERE ( [PublicidadId] > @PublicidadId) ORDER BY [PublicidadId]  OPTION (FAST 1)",true, GxErrorMask.GX_NOMASK, false, this,prmT00068,1,0,true,true )
             ,new CursorDef("T00069", "SELECT TOP 1 [PublicidadId] FROM [Publicidad] WITH (NOLOCK) WHERE ( [PublicidadId] < @PublicidadId) ORDER BY [PublicidadId] DESC  OPTION (FAST 1)",true, GxErrorMask.GX_NOMASK, false, this,prmT00069,1,0,true,true )
             ,new CursorDef("T000610", "SELECT [PublicidadId], [PublicidadDetalle], [PublicidadImg] FROM [Publicidad] WITH (UPDLOCK) WHERE [PublicidadId] = @PublicidadId ",true, GxErrorMask.GX_NOMASK, false, this,prmT000610,1,0,true,false )
             ,new CursorDef("T000611", "INSERT INTO [Publicidad] ([PublicidadImg], [PublicidadDetalle]) VALUES (@PublicidadImg, @PublicidadDetalle)", GxErrorMask.GX_NOMASK,prmT000611)
             ,new CursorDef("T000612", "SELECT Ident_Current('[Publicidad]') ",true, GxErrorMask.GX_NOMASK, false, this,prmT000612,1,0,true,false )
             ,new CursorDef("T000613", "UPDATE [Publicidad] SET [PublicidadDetalle]=@PublicidadDetalle  WHERE [PublicidadId] = @PublicidadId", GxErrorMask.GX_NOMASK,prmT000613)
             ,new CursorDef("T000614", "UPDATE [Publicidad] SET [PublicidadImg]=@PublicidadImg  WHERE [PublicidadId] = @PublicidadId", GxErrorMask.GX_NOMASK,prmT000614)
             ,new CursorDef("T000615", "DELETE FROM [Publicidad]  WHERE [PublicidadId] = @PublicidadId", GxErrorMask.GX_NOMASK,prmT000615)
             ,new CursorDef("T000616", "SELECT TOP 1 [GuiaId], [PublicidadId] FROM [GuiaPublicidad] WITH (NOLOCK) WHERE [PublicidadId] = @PublicidadId ",true, GxErrorMask.GX_NOMASK, false, this,prmT000616,1,0,true,true )
             ,new CursorDef("T000617", "SELECT [PublicidadId] FROM [Publicidad] WITH (NOLOCK) ORDER BY [PublicidadId]  OPTION (FAST 100)",true, GxErrorMask.GX_NOMASK, false, this,prmT000617,100,0,true,false )
             ,new CursorDef("T000618", "SELECT [PublicidadId], [PCostoFecha], [PCostoMonto] FROM [PublicidadPCosto] WITH (NOLOCK) WHERE [PublicidadId] = @PublicidadId and [PCostoFecha] = @PCostoFecha ORDER BY [PublicidadId], [PCostoFecha] ",true, GxErrorMask.GX_NOMASK, false, this,prmT000618,11,0,true,false )
             ,new CursorDef("T000619", "SELECT [PublicidadId], [PCostoFecha] FROM [PublicidadPCosto] WITH (NOLOCK) WHERE [PublicidadId] = @PublicidadId AND [PCostoFecha] = @PCostoFecha ",true, GxErrorMask.GX_NOMASK, false, this,prmT000619,1,0,true,false )
             ,new CursorDef("T000620", "INSERT INTO [PublicidadPCosto] ([PublicidadId], [PCostoFecha], [PCostoMonto]) VALUES (@PublicidadId, @PCostoFecha, @PCostoMonto)", GxErrorMask.GX_NOMASK,prmT000620)
             ,new CursorDef("T000621", "UPDATE [PublicidadPCosto] SET [PCostoMonto]=@PCostoMonto  WHERE [PublicidadId] = @PublicidadId AND [PCostoFecha] = @PCostoFecha", GxErrorMask.GX_NOMASK,prmT000621)
             ,new CursorDef("T000622", "DELETE FROM [PublicidadPCosto]  WHERE [PublicidadId] = @PublicidadId AND [PCostoFecha] = @PCostoFecha", GxErrorMask.GX_NOMASK,prmT000622)
             ,new CursorDef("T000623", "SELECT [PublicidadId], [PCostoFecha] FROM [PublicidadPCosto] WITH (NOLOCK) WHERE [PublicidadId] = @PublicidadId ORDER BY [PublicidadId], [PCostoFecha] ",true, GxErrorMask.GX_NOMASK, false, this,prmT000623,11,0,true,false )
          };
       }
    }

    public void getResults( int cursor ,
                            IFieldGetter rslt ,
                            Object[] buf )
    {
       switch ( cursor )
       {
             case 0 :
                ((short[]) buf[0])[0] = rslt.getShort(1) ;
                ((DateTime[]) buf[1])[0] = rslt.getGXDate(2) ;
                ((short[]) buf[2])[0] = rslt.getShort(3) ;
                break;
             case 1 :
                ((short[]) buf[0])[0] = rslt.getShort(1) ;
                ((DateTime[]) buf[1])[0] = rslt.getGXDate(2) ;
                ((short[]) buf[2])[0] = rslt.getShort(3) ;
                break;
             case 2 :
                ((short[]) buf[0])[0] = rslt.getShort(1) ;
                ((short[]) buf[1])[0] = rslt.getShort(2) ;
                ((String[]) buf[2])[0] = rslt.getBLOBFile(3, "tmp", "") ;
                break;
             case 3 :
                ((short[]) buf[0])[0] = rslt.getShort(1) ;
                ((short[]) buf[1])[0] = rslt.getShort(2) ;
                ((String[]) buf[2])[0] = rslt.getBLOBFile(3, "tmp", "") ;
                break;
             case 4 :
                ((short[]) buf[0])[0] = rslt.getShort(1) ;
                ((short[]) buf[1])[0] = rslt.getShort(2) ;
                ((String[]) buf[2])[0] = rslt.getBLOBFile(3, "tmp", "") ;
                break;
             case 5 :
                ((short[]) buf[0])[0] = rslt.getShort(1) ;
                break;
             case 6 :
                ((short[]) buf[0])[0] = rslt.getShort(1) ;
                break;
             case 7 :
                ((short[]) buf[0])[0] = rslt.getShort(1) ;
                break;
             case 8 :
                ((short[]) buf[0])[0] = rslt.getShort(1) ;
                ((short[]) buf[1])[0] = rslt.getShort(2) ;
                ((String[]) buf[2])[0] = rslt.getBLOBFile(3, "tmp", "") ;
                break;
             case 10 :
                ((short[]) buf[0])[0] = rslt.getShort(1) ;
                break;
             case 14 :
                ((short[]) buf[0])[0] = rslt.getShort(1) ;
                ((short[]) buf[1])[0] = rslt.getShort(2) ;
                break;
             case 15 :
                ((short[]) buf[0])[0] = rslt.getShort(1) ;
                break;
             case 16 :
                ((short[]) buf[0])[0] = rslt.getShort(1) ;
                ((DateTime[]) buf[1])[0] = rslt.getGXDate(2) ;
                ((short[]) buf[2])[0] = rslt.getShort(3) ;
                break;
             case 17 :
                ((short[]) buf[0])[0] = rslt.getShort(1) ;
                ((DateTime[]) buf[1])[0] = rslt.getGXDate(2) ;
                break;
             case 21 :
                ((short[]) buf[0])[0] = rslt.getShort(1) ;
                ((DateTime[]) buf[1])[0] = rslt.getGXDate(2) ;
                break;
       }
    }

    public void setParameters( int cursor ,
                               IFieldSetter stmt ,
                               Object[] parms )
    {
       switch ( cursor )
       {
             case 0 :
                stmt.SetParameter(1, (short)parms[0]);
                stmt.SetParameter(2, (DateTime)parms[1]);
                break;
             case 1 :
                stmt.SetParameter(1, (short)parms[0]);
                stmt.SetParameter(2, (DateTime)parms[1]);
                break;
             case 2 :
                stmt.SetParameter(1, (short)parms[0]);
                break;
             case 3 :
                stmt.SetParameter(1, (short)parms[0]);
                break;
             case 4 :
                stmt.SetParameter(1, (short)parms[0]);
                break;
             case 5 :
                stmt.SetParameter(1, (short)parms[0]);
                break;
             case 6 :
                stmt.SetParameter(1, (short)parms[0]);
                break;
             case 7 :
                stmt.SetParameter(1, (short)parms[0]);
                break;
             case 8 :
                stmt.SetParameter(1, (short)parms[0]);
                break;
             case 9 :
                stmt.SetParameter(1, (String)parms[0]);
                stmt.SetParameter(2, (short)parms[1]);
                break;
             case 11 :
                stmt.SetParameter(1, (short)parms[0]);
                stmt.SetParameter(2, (short)parms[1]);
                break;
             case 12 :
                stmt.SetParameter(1, (String)parms[0]);
                stmt.SetParameter(2, (short)parms[1]);
                break;
             case 13 :
                stmt.SetParameter(1, (short)parms[0]);
                break;
             case 14 :
                stmt.SetParameter(1, (short)parms[0]);
                break;
             case 16 :
                stmt.SetParameter(1, (short)parms[0]);
                stmt.SetParameter(2, (DateTime)parms[1]);
                break;
             case 17 :
                stmt.SetParameter(1, (short)parms[0]);
                stmt.SetParameter(2, (DateTime)parms[1]);
                break;
             case 18 :
                stmt.SetParameter(1, (short)parms[0]);
                stmt.SetParameter(2, (DateTime)parms[1]);
                stmt.SetParameter(3, (short)parms[2]);
                break;
             case 19 :
                stmt.SetParameter(1, (short)parms[0]);
                stmt.SetParameter(2, (short)parms[1]);
                stmt.SetParameter(3, (DateTime)parms[2]);
                break;
             case 20 :
                stmt.SetParameter(1, (short)parms[0]);
                stmt.SetParameter(2, (DateTime)parms[1]);
                break;
             case 21 :
                stmt.SetParameter(1, (short)parms[0]);
                break;
       }
    }

 }

}
